示例#1
0
 public AIHunter(Model model, Controller controller, Unit controlledUnit)
 {
     this.model          = model;
     this.controller     = controller;
     this.controlledUnit = controlledUnit;
     this.myPlan         = new TurnPlan();
 }
示例#2
0
    void HandleTurnStarted(object sender, EventProxyArgs args)
    {
        if (!model.matchRunning)
        {
            return;
        }

        // perform AI planning and execute it if the active unit is AI controled
        TurnStartedEvent e = args as TurnStartedEvent;

        if (e.unit.AIControled)
        {
            TurnPlan plan = e.unit.ai.DoPlanning();
            // execute turn plan
            MoveUnit(e.unit, plan.movementTarget);

            // check again if this unit is dead (might have died from field effects)
            if (!e.unit.Alive)
            {
                EndTurn();
                return;
            }

            AttackMapTile(e.unit, plan.attackTarget.mapTile, plan.attack);
        }
    }