Skip to content

Commit

Permalink
组件的Parent应该是Component,这里漏改了
Browse files Browse the repository at this point in the history
  • Loading branch information
egametang committed Mar 16, 2018
1 parent e13b22f commit 613f2d9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions Server/App/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ private static void Main(string[] args)
Game.Scene.AddComponent<UnitComponent>();
Game.Scene.AddComponent<DBComponent>();
Game.Scene.AddComponent<DBProxyComponent>();
Game.Scene.AddComponent<DBCacheComponent>();
Game.Scene.AddComponent<LocationComponent>();
Game.Scene.AddComponent<ActorMessageDispatherComponent>();
Game.Scene.AddComponent<ActorManagerComponent>();
Expand Down
5 changes: 3 additions & 2 deletions Unity/Assets/Scripts/Base/Object/Component.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ public abstract partial class Component: Disposer
public long Id { get; set; }

[BsonIgnore]
public Disposer Parent { get; set; }
public Component Parent { get; set; }

public T GetParent<T>() where T : Disposer
public T GetParent<T>() where T : Component
{
return this.Parent as T;
}

[BsonIgnore]
public Entity Entity
{
get
Expand Down
2 changes: 1 addition & 1 deletion Unity/Hotfix/Base/Object/Component.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public abstract class Component : Disposer
[BsonIgnore]
public Component Parent { get; set; }

public T GetParent<T>() where T : Entity
public T GetParent<T>() where T : Component
{
return this.Parent as T;
}
Expand Down

0 comments on commit 613f2d9

Please sign in to comment.