Exemple #1
0
 public void ResetCommandMenu()
 {
     StopAllCoroutines();
     allyInstances  = UnitManager.Instance.allies;
     enemyInstances = UnitManager.Instance.currentEnemies;
     SetActiveUnit();
     unitCursor.gameObject.SetActive(true);
     unitCursor.FollowNewUnit(activeUnit);
     commandMenuState = CommandMenuState.SelectingCommand;
 }
Exemple #2
0
    public IEnumerator SelectCommandTarget(Unit[] targetPool)
    {
        MenuManager.Instance.SetMenuActive(false);
        commandMenuState = CommandMenuState.SelectingTarget;
        int selectedTarget = 0;

        unitCursor.FollowNewUnit(targetPool[selectedTarget]);
        yield return(null);

        while (!Input.GetKeyDown(KeyCode.Space))
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                commandTarget = null;
                MenuManager.Instance.SetMenuActive(true);
                unitCursor.FollowNewUnit(activeUnit);
                commandMenuState = CommandMenuState.SelectingCommand;
                yield break;
            }
            else if (Input.GetKeyDown(KeyCode.S) && selectedTarget < targetPool.Length - 1)
            {
                selectedTarget++;
                unitCursor.FollowNewUnit(targetPool[selectedTarget]);
            }
            else if (Input.GetKeyDown(KeyCode.W) && selectedTarget > 0)
            {
                selectedTarget--;
                unitCursor.FollowNewUnit(targetPool[selectedTarget]);
            }
            yield return(null);
        }
        commandTarget = targetPool[selectedTarget];
        activeUnit.ExecuteAction(activeUnit.commands[selectedAction], commandTarget);
        MenuManager.Instance.SetMenuActive(false);
        commandMenuState = CommandMenuState.SelectingCommand;
        unitCursor.gameObject.SetActive(false);
    }