Exemplo n.º 1
0
 public void ChooseTargetMode(bool shouldShow, BattleActionTargetingType mode = BattleActionTargetingType.SINGLE_ALLY_TARGET)
 {
     if (shouldShow)
     {
         if (mode == BattleActionTargetingType.SINGLE_ALLY_TARGET)
         {
             foreach (BattleCharacter bc in allies)
             {
                 bc.ShowCharacterMenu(true);
             }
         }
         else if (mode == BattleActionTargetingType.SINGLE_ENEMY_TARGET)
         {
             foreach (BattleCharacter bc in enemies)
             {
                 bc.ShowCharacterMenu(true);
             }
         }
     }
     else
     {
         foreach (BattleCharacter bc in allies)
         {
             bc.ShowCharacterMenu(false);
         }
         foreach (BattleCharacter bc in enemies)
         {
             bc.ShowCharacterMenu(false);
         }
     }
 }
    public void ChooseAction(int actionSelection = -1)
    {
        _actionSelection = actionSelection;

        //choose an action (actionselection is an INDEX!)
        if (Input.GetKeyUp(KeyCode.Alpha1))
        {
            _actionSelection = 0;
        }
        else if (Input.GetKeyUp(KeyCode.Alpha2))
        {
            _actionSelection = 1;
        }
        else if (Input.GetKeyUp(KeyCode.Alpha3))
        {
            _actionSelection = 2;
        }
        else if (Input.GetKeyUp(KeyCode.Alpha4))
        {
            _actionSelection = 3;
        }

        //add more cases as necessary

        if (_actionSelection != -1 && _actionSelection < _actions.Count)
        {
            BattleActionTargetingType batt = _actions[_actionSelection].actionTargetType;
            Debug.Log("Action targetting type was " + batt);
            if (batt != BattleActionTargetingType.SELF &&
                batt != BattleActionTargetingType.ENEMY_PARTY &&
                batt != BattleActionTargetingType.ALLY_PARTY)
            {
                _manager.ChooseTargetMode(true, batt);
                //we need to choose a target
                _choosingTarget = true;
                PrintAvailableTargets();
            }
            else
            {
                //we can queue without a target
                QueueAction();
            }
        }
        else if (_actionSelection > -1)
        {
            Debug.Log("There's no action in that slot");
        }
    }