public ExternalCaptureActor(Actor self, Target target) { this.target = target; capturable = target.Actor.Trait<ExternalCapturable>(); capturesInfo = self.Info.TraitInfo<ExternalCapturesInfo>(); mobile = self.Trait<Mobile>(); }
public PathSearch(Actor self) { this.self = self; world = self.World; cellInfo = InitCellInfo(); mobile = self.Trait<Mobile>(); queue = new PriorityQueue<PathDistance>(); }
public FindResources(Actor self) { harv = self.Trait<Harvester>(); harvInfo = self.Info.Traits.Get<HarvesterInfo>(); mobile = self.Trait<Mobile>(); mobileInfo = self.Info.Traits.Get<MobileInfo>(); resLayer = self.World.WorldActor.Trait<ResourceLayer>(); territory = self.World.WorldActor.TraitOrDefault<ResourceClaimLayer>(); pathFinder = self.World.WorldActor.Trait<IPathFinder>(); }
public MoveAdjacentTo(Actor self, Target target) { Target = target; mobile = self.Trait<Mobile>(); pathFinder = self.World.WorldActor.Trait<IPathFinder>(); domainIndex = self.World.WorldActor.Trait<DomainIndex>(); movementClass = (uint)mobile.Info.GetMovementClass(self.World.TileSet); if (target.IsValidFor(self)) targetPosition = self.World.Map.CellContaining(target.CenterPosition); repath = true; }
public Leap(Actor self, Actor target, WeaponInfo weapon, WDist speed, WAngle angle) { var targetMobile = target.TraitOrDefault<Mobile>(); if (targetMobile == null) throw new InvalidOperationException("Leap requires a target actor with the Mobile trait"); this.weapon = weapon; this.angle = angle; mobile = self.Trait<Mobile>(); mobile.SetLocation(mobile.FromCell, mobile.FromSubCell, targetMobile.FromCell, targetMobile.FromSubCell); mobile.IsMoving = true; from = self.CenterPosition; to = self.World.Map.CenterOfSubCell(targetMobile.FromCell, targetMobile.FromSubCell); length = Math.Max((to - from).Length / speed.Length, 1); // HACK: why isn't this using the interface? self.Trait<WithInfantryBody>().Attacking(self, Target.FromActor(target)); if (weapon.Report != null && weapon.Report.Any()) Sound.Play(weapon.Report.Random(self.World.SharedRandom), self.CenterPosition); }
public AttackMove(Actor self, AttackMoveInfo info) { Info = info; mobile = self.Trait<Mobile>(); }