You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.6 KiB
66 lines
1.6 KiB
using System.Collections.Generic; |
|
|
|
namespace ET |
|
{ |
|
public class GatherComponentDestroySystem : DestroySystem<GatherComponent> |
|
{ |
|
public override void Destroy(GatherComponent self) |
|
{ |
|
|
|
} |
|
} |
|
|
|
[FriendClass(typeof(Gather))] |
|
public static class GatherComponentSystem |
|
{ |
|
|
|
public static Gather GetGatherByPeopleId(this GatherComponent self, long peopleId) |
|
{ |
|
foreach (var v in self.Children) |
|
{ |
|
var gather = (Gather) v.Value; |
|
if (gather.HavePeople(peopleId)) |
|
{ |
|
return gather; |
|
} |
|
} |
|
|
|
return null; |
|
} |
|
|
|
public static Gather GetherByResPointId(this GatherComponent self, long resId) |
|
{ |
|
foreach (var v in self.Children) |
|
{ |
|
var res = (Gather) v.Value; |
|
if (res.ResPointId==resId) |
|
{ |
|
return res; |
|
} |
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
#if SERVER |
|
public static void Update(this GatherComponent self, Unit unit,int tick) |
|
{ |
|
Dictionary<long, ResourceAttri> resAttriDic = new Dictionary<long, ResourceAttri>(); |
|
foreach (var v in self.Children) |
|
{ |
|
var gather = (Gather)v.Value; |
|
var attri = gather.Product(unit,tick); |
|
resAttriDic[gather.ResPointId] = attri; |
|
} |
|
GatherHelper.NotifyResourceAttri(unit,resAttriDic); |
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
} |