Пример #1
0
    public void OnTrigger(BaseEvent e)
    {
        theEvent = e;
        uiCanvas = theEvent.UICanvas;

        // Lock player movement
        player.lockPlayer();

        //		battleLogTextUI.text = GetNextScriptAndAdvanceIndex();
        battleLog.AddNewElement(GetNextScriptAndAdvanceIndex());

        talkButton.onClick.AddListener(OnTalk);
    }
Пример #2
0
    public void HandleInput()
    {
        Debug.Log("Handle Input");
        string input = GetPlayerInput();

        Debug.Log(input);
        if (input != "" && scenarioScriptIndex >= scenarioScript.Count)
        {
            if (enemy.CanTakeAction(input))
            {
                scenarioScript.Add(enemy.ActionTaken(input));
                battleLog.AddNewElement(GetNextScriptAndAdvanceIndex());
                //
            }
            else
            {
                scenarioScript.Add(enemy.ActionNotTaken(input));
                battleLog.AddNewElement(GetNextScriptAndAdvanceIndex());
                //
            }
        }

        if (enemy.IsDead())
        {
            battleLog.AddNewElement(enemy.defeated);
            defeated            = true;
            playerinput.enabled = false;
        }
        else
        {
            //Enemy Generate Action towards player
            string enemyAction = enemy.GenerateAction();
            Debug.Log("Enemy takes action: " + enemyAction);
            if (player.CanTakeAction(enemyAction))
            {
                scenarioScript.Add(player.ActionTaken(enemyAction, enemy.EnemyName));
                battleLog.AddNewElement(GetNextScriptAndAdvanceIndex());
                //
            }
            else
            {
                scenarioScript.Add(player.ActionNotTaken(enemyAction, enemy.EnemyName));
                battleLog.AddNewElement(GetNextScriptAndAdvanceIndex());
                //
            }
            if (player.IsDead())
            {
                battleLog.AddNewElement(player.defeated);
                //
                playerinput.enabled = false;
            }
        }



        Debug.Log("Enemy status: " + enemy.GetTrait(Trait.Type.PHYSICAL).currentValue.ToString() + " / " + enemy.GetTrait(Trait.Type.MENTAL).currentValue.ToString());
        Debug.Log("Player status: " + player.GetTrait(Trait.Type.PHYSICAL).currentValue.ToString() + " / " + player.GetTrait(Trait.Type.MENTAL).currentValue.ToString());
    }