|
|
|
@ -49,6 +49,7 @@ namespace ET
|
|
|
|
|
[FriendClass(typeof (Unit))] |
|
|
|
|
[FriendClass(typeof (Farmland))] |
|
|
|
|
[FriendClass(typeof (Building))] |
|
|
|
|
[FriendClass(typeof (Cabin))] |
|
|
|
|
|
|
|
|
|
public static class UnitSystem |
|
|
|
|
{ |
|
|
|
@ -341,5 +342,28 @@ namespace ET
|
|
|
|
|
((Building) v).Durable -= config.DurableDestroy; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void OnCheckCabin(this Unit self) |
|
|
|
|
{ |
|
|
|
|
foreach (var v in self.GrandChildren.Values) |
|
|
|
|
{ |
|
|
|
|
if (v.GetType() == typeof (Cabin)) |
|
|
|
|
{ |
|
|
|
|
Cabin cabin = (Cabin) v; |
|
|
|
|
if (cabin.ResidentState == 1) |
|
|
|
|
{ |
|
|
|
|
foreach (var id in cabin.FarmlandIds) |
|
|
|
|
{ |
|
|
|
|
var farmland = self.GetGrandChild<Farmland>(id); |
|
|
|
|
if (farmland != null && farmland.FarmlandState == FarmlandState.FARMLAND_STATE_SEED) |
|
|
|
|
{ |
|
|
|
|
farmland.FarmlandState = FarmlandState.FARMLAND_STATE_GROW; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |