Esempio n. 1
0
 void SetTarget()
 {
     CommandManagement.target        = null;
     CommandManagement.pointSelected = ProgUtils.GetClickPoint();
     //Get Click Point also sets CommandManagement.target to
     //what it clicked on, if it clicked on an enemy
     if (CommandManagement.target != null)
     {
         //if the target is not null, it means GetClickPoint found an enemy so attack it
         //the Combat class handles movement towards enemies so it isn't done here
         CommandManagement.SetAttackTargets();
     }
     else
     {
         //There was no enemy so just move to the pointSelected as usual
         CommandManagement.MoveTroops();
     }
 }
Esempio n. 2
0
    void SetTarget()
    {
        GameObject newTarget = null;

        //Have to reset commandManager's current target to null so right clicks disengage by default
        commandManager.target = null;

        //get click point will set newTarget to whatever the player clicked on
        commandManager.pointSelected = ProgUtils.GetClickPoint(cam, out newTarget);


        if (newTarget != null && newTarget.tag == commandManager.GetEnemySide())
        {
            //the Combat class handles movement towards enemies so it isn't done here
            commandManager.SetManagerTarget(newTarget);
            commandManager.SetAttackTargets();
        }
        else
        {
            //There was no enemy so just move to the pointSelected as usual
            commandManager.MoveTroops();
        }
    }