コード例 #1
0
    public void OpenCombatBG(CombatScriptable currentCombatScript)
    {
        CloseLocationUI();
        CloseEncounterUI();

        CombatUIBG.GetComponent <CombatManager>().StartCombat(currentCombatScript);
    }
コード例 #2
0
//Sneak Away, Sneak Past, Sneak Attack, & Steal & Take are ONLY AVAILABLE WHEN THE TEXT INDICATES THE ENEMY IS UNAWARE OF THE PLAYER
//Run Past and Sneak Past are ONLY AVAILABLE WHEN PLAYING ADVANCED RULES

    public void InitializeActionBG()
    {
        bool playerHasRelevantSpells = false;

        runAwayButton.SetActive(false);
        runPastButton.SetActive(false);
        sneakAttackButton.SetActive(false);
        sneakAwayButton.SetActive(false);
        sneakPastButton.SetActive(false);
        stealTakeButton.SetActive(false);

        actionResultProceedButton.SetActive(false);
        actionResultMoveOnButton.SetActive(false);

        actionMoveOnRandomly = false;

        //if (MapSceneManager.currentEncounter.myEncounterScriptable.canRunAwayPast) {
        runAwayButton.SetActive(true);
        runPastButton.SetActive(true);
        //}

        if (MapSceneManager.currentEncounter.myEncounterScriptable.enemyUnaware)
        {
            sneakAttackButton.SetActive(true);
            sneakAwayButton.SetActive(true);
            sneakPastButton.SetActive(true);
            stealTakeButton.SetActive(true);

            for (int s = 0; s < CharacterManager.spellScriptables.Length; s++)
            {
                if (CharacterManager.spellScriptables[s] != null)
                {
                    if (CharacterManager.spellScriptables[s].spellIndex == 14)                      //If the player knows the Telekinesis spell
                    {
                        playerHasRelevantSpells = true;
                        //encounterSpellUI.SetActive(true);
                        telekinesisButton.SetActive(true);
                    }
                }
            }
        }
        else
        {
            //If the enemy is aware of the player
            if (MapSceneManager.currentEncounter.myEncounterScriptable.enemyAwareAndHostile)
            {
                for (int s = 0; s < CharacterManager.spellScriptables.Length; s++)
                {
                    if (CharacterManager.spellScriptables[s] != null)
                    {
                        if (CharacterManager.spellScriptables[s].spellIndex == 2)                           //If the player knows the Calm spell
                        {
                            playerHasRelevantSpells = true;
                            CombatScriptable fightEncounterScript = mapSceneManager.gameObject.GetComponent <EncounterManager>().encounterTextScriptables[MapSceneManager.currentEncounter.myEncounterScriptable.fightEncounter].combatScript;
                            if (fightEncounterScript != null)
                            {
                                if (fightEncounterScript.enemyCount == 1)
                                {
                                    //encounterSpellUI.SetActive(true);
                                    calmButton.SetActive(true);
                                }
                                else
                                {
                                    //encounterSpellUI.SetActive(false);
                                    calmButton.SetActive(false);

                                    Debug.Log("\nYou can't cast your Calm spell!\nThere are too many enemies!");
                                }
                            }
                            else
                            {
                                //encounterSpellUI.SetActive(false);
                                calmButton.SetActive(false);

                                Debug.LogError("Couldn't find a fight script for casting Calm!", this.gameObject);
                                Debug.Break();
                            }
                        }
                    }
                }
            }
        }

        if (playerHasRelevantSpells)
        {
            encounterSpellUI.SetActive(true);
        }
        else
        {
            //KEEP
            //encounterSpellUI.SetActive(false);
        }
    }