public override IDecisionTreeNode MakeDecision(AiContext context) { var(coord, time) = Unit.NextMove; new StartMoveCommand(context, Unit, coord, time, Bus).Execute(); context.InsertCommand(time, new FinishMoveCommand(context, Unit, coord, Bus)); context.InsertCommand(time, new MakeDecisionCommand(Unit, context, time)); return(this); }
public override IDecisionTreeNode MakeDecision(AiContext context) { context.InsertCommand(Zero, new ApplyDamageCommand(Unit, context, Bus)); //inserting to heap because units can attack at the same time context.InsertCommand(Unit.TimeToFinishAttackAnimation, new FinishAttackCommand(Unit, Bus)); var time = Max(Unit.AttackSpeedTime, Unit.TimeToFinishAttackAnimation); context.InsertCommand(time, new MakeDecisionCommand(Unit, context, time)); return(this); }
public override IDecisionTreeNode MakeDecision(AiContext context) { var decisionCommand = new WaitForAlliesToMoveCommand(Unit, context); context.InsertCommand(Zero, decisionCommand); return(this); }
public override IDecisionTreeNode MakeDecision(AiContext context) { var decisionCommand = new MakeDecisionCommand(Unit, context, MoveDiffTime); context.InsertCommand(MoveDiffTime, decisionCommand); Bus.Raise(new IdleEvent(Unit.Coord)); return(this); }
public override IDecisionTreeNode MakeDecision(AiContext context) { var time = Unit.Target.TimeWhenDecisionWillBeExecuted - context.CurrentTime; context.InsertCommand(time, new MakeDecisionCommand(Unit, context, time)); Bus.Raise(new IdleEvent(Unit.Coord)); return(this); }
public override IDecisionTreeNode MakeDecision(AiContext context) { Unit.StartAttack(context.CurrentTime); context.InsertCommand(Unit.AttackAnimationHitTime, new MakeDecisionCommand(Unit, context, Unit.AttackAnimationHitTime)); Bus.Raise(new RotateEvent(Unit.Coord, Unit.Target.Coord)); Bus.Raise(new StartAttackEvent(Unit.Coord)); return(this); }
public override IDecisionTreeNode MakeDecision(AiContext context) { var units = context.EnemyUnits(Unit.Player); //TODO: check if it's moving and if so record that in unit var target = Unit.FindNearestTarget(units); Unit.ChangeTargetTo(target); context.InsertCommand(Zero, new MakeDecisionCommand(Unit, context, Zero)); return(this); }