public override Activity Tick(Actor self) { if (ChildActivity != null) { ChildActivity = ActivityUtils.RunActivityTick(self, ChildActivity); if (ChildActivity != null) { return(this); } } //if (IsCanceling || harv.IsFull) // return NextActivity; // Move towards the target cell if (self.Location != targetCell) { //foreach (var n in self.TraitsImplementing<INotifyHarvesterAction>()) // n.MovingToResources(self, targetCell, new FindAndDeliverResources(self)); self.SetTargetLine(Target.FromCell(self.World, targetCell), Color.Red, false); QueueChild(self, move.MoveTo(targetCell, 2), true); return(this); } if (!harv.CanHarvestCell(self, self.Location)) { return(NextActivity); } // Turn to one of the harvestable facings //if (harvInfo.HarvestFacings != 0) //{ // var current = facing.Facing; // var desired = body.QuantizeFacing(current, harvInfo.HarvestFacings); // if (desired != current) // { // QueueChild(self, new Turn(self, desired), true); // return this; // } //} var resource = resLayer.Harvest(self.Location); if (resource == null) { return(NextActivity); } harv.AcceptResource(self, resource); // это событие ловится WithHarverAnimation классом, чтобы 1 раз проиграть анимацию сборки спайса. //foreach (var t in self.TraitsImplementing<INotifyHarvesterAction>()) // t.Harvested(self, resource); foreach (var t in self.TraitsImplementing <INotifyAttack>()) { if (t is OpenRA.Mods.Common.Traits.Render.WithAttackOverlay) //возьмем анимацию для поедания из анимации атаки. { t.PreparingAttack(self, new Target(), null, null); } } //этой Activity делается пауза после одного съедания спайса, чтобы не сосать как пылесосом и подождать анимацию глотания спайса //QueueChild(self, new Wait(500), true); return(this); }