public Cargo(ActorInitializer init, CargoInfo info) { this.self = init.self; this.info = info; if (init.Contains <CargoInit>()) { cargo = init.Get <CargoInit, Actor[]>().ToList(); totalWeight = cargo.Sum(c => GetWeight(c)); } else { foreach (var u in info.InitialUnits) { var unit = self.World.CreateActor(false, u.ToLowerInvariant(), new TypeDictionary { new OwnerInit(self.Owner) }); if (CanLoad(self, unit)) { Load(self, unit); } } } }
public Cargo(ActorInitializer init, CargoInfo info) { this.self = init.self; this.info = info; if (init.Contains <CargoInit>()) { cargo = init.Get <CargoInit, Actor[]>().ToList(); totalWeight = cargo.Sum(c => GetWeight(c)); } }
public Cargo(ActorInitializer init, CargoInfo info) { self = init.self; Info = info; Unloading = false; if (init.Contains <RuntimeCargoInit>()) { cargo = init.Get <RuntimeCargoInit, Actor[]>().ToList(); totalWeight = cargo.Sum(c => GetWeight(c)); } else if (init.Contains <CargoInit>()) { foreach (var u in init.Get <CargoInit, string[]>()) { var unit = self.World.CreateActor(false, u.ToLowerInvariant(), new TypeDictionary { new OwnerInit(self.Owner) }); cargo.Add(unit); } totalWeight = cargo.Sum(c => GetWeight(c)); } else { foreach (var u in info.InitialUnits) { var unit = self.World.CreateActor(false, u.ToLowerInvariant(), new TypeDictionary { new OwnerInit(self.Owner) }); cargo.Add(unit); } totalWeight = cargo.Sum(c => GetWeight(c)); } }