示例#1
0
 void OnClickChoiceButton(Choice choice)
 {
     buttonClicked = true;
     audioManager.Play("Click");
     foreach (int val in goodChoice)
     {
         if (val == choice.index)
         {
             addAffinity.AddPoints(this.gameObject.tag, 1);
             break;
         }
     }
     story.ChooseChoiceIndex(choice.index);
     StartCoroutine(refresh());
 }
示例#2
0
    void EndBattle()
    {
        TinderData tinderData = GameObject.FindGameObjectWithTag("persistentData").GetComponent <TinderData>();

        battleUI.DecisionQuitButton_text.text = "Sair";
        StopAllCoroutines();
        AddAffinity addAffinity = GameObject.FindGameObjectWithTag("BattleManager").GetComponent <AddAffinity>();
        string      tag         = addAffinity.CharacterTag(enemyUnit.cBase.name);

        if (state == BattleState.WON)
        {
            battleUI.DecisionPanel.SetActive(true);
            battleUI.DecisionQuitButton.SetActive(true);
            battleUI.wonDatePanel.SetActive(true);
            Debug.Log("won date");
            battleUI.CombatPanel.SetActive(false);
            Debug.Log("combat");
            battleUI.StartCoroutine(battleUI.showText("Você ganhou o encontro! "));
            tinderData.advanceCharacterDay();
            tinderData.curDay += 1;
            addAffinity.AddPoints(tag, 2);
        }
        else if (state == BattleState.LOST)
        {
            battleUI.DecisionPanel.SetActive(true);
            battleUI.lostDatePanel.SetActive(true);
            Debug.Log("lost date");
            battleUI.DecisionQuitButton.SetActive(true);
            battleUI.CombatPanel.SetActive(false);
            Debug.Log("combat");
            battleUI.StartCoroutine(battleUI.showText("Você foi derrotado. "));
            tinderData.curDay += 1;
            tinderData.advanceCharacterDay();
            addAffinity.AddPoints(tag, 3);
        }
        if (tinderData.curDay == 6)
        {
            tinderData.curDay -= 1;
            appSave.curDay     = tinderData.curDay;
            SaveSystem.GetInstance().SaveState();
            CheckAffinity checkAffinity = GameObject.FindGameObjectWithTag("BattleManager").GetComponent <CheckAffinity>();
            if (checkAffinity.CheckIfHasAffinity(enemyUnit.cBase.name))
            {
                checkAffinity.ListNumber(enemyUnit.cBase.name);
                SceneManager.LoadScene("TheEnd");
            }
            else
            {
                affinityCanvas.gameObject.SetActive(true);
                if (checkAffinity.HasAffinityWithSomeone())
                {
                    hasAffinity.gameObject.SetActive(true);
                    renewDay.gameObject.SetActive(true);
                }
                else
                {
                    if (state == BattleState.LOST)
                    {
                        checkAffinity.SubtractPoints(tag, 16);
                    }
                    else if (state == BattleState.WON)
                    {
                        checkAffinity.SubtractPoints(tag, 18);
                    }
                    appSave.renewDay = true;
                    SaveSystem.GetInstance().SaveState();
                    doesntHaveAffinity.gameObject.SetActive(true);
                }
            }
        }
        appSave.curDay = tinderData.curDay;
        SaveSystem.GetInstance().SaveState();
    }