Exemplo n.º 1
0
    private void CreateOption(OptionForEvent optionForEvent, Vector3 position)
    {
        GameObject option = Instantiate(optionButton, panel);

        option.GetComponent <ButtonOption>().InitializeButtonInfo(this.gameObject, optionForEvent);
        option.transform.localPosition = position;
        listOfOptions.Add(option);
    }
Exemplo n.º 2
0
 public void NotifySelectOption(OptionForEvent optionSelected)
 {
     for (int i = 0; i < listOfOptions.Count; i++)
     {
         if (optionSelected.Equals(listOfOptions[i].GetComponent <ButtonOption>().GetOptionInfo()))
         {
             Debug.Log("opcion encontrada");
             eventContainer.DealWithOption(optionSelected);
         }
     }
 }
Exemplo n.º 3
0
    public void DealWithOption(OptionForEvent _option)
    {
        GameObject gameManager = GameObject.FindGameObjectWithTag("GameManager");

        Debug.Log("option selected:" + _option.Title);
        switch (_option.optionType)
        {
        case Enumerations.OptionType.Gold:
            if (_option.Add)
            {
                //add money
                GameObject deckInfo = GameObject.FindGameObjectWithTag("DeckInformation");
                deckInfo.GetComponent <DeckInformation>().AddGold(_option.value);
            }
            else
            {
                //get moneyAvailable
                GameObject deckInfo = GameObject.FindGameObjectWithTag("DeckInformation");
                int        money    = 0;
                money = deckInfo.GetComponent <DeckInformation>().GetGold();
                if (_option.value > money)
                {
                    if (_option.canIgnoreFight)
                    {
                        //keep walking

                        gameManager.GetComponent <GameManagerController>().StartCoroutine("FleeOption", 2);
                    }
                    else
                    {
                        //fight

                        gameManager.GetComponent <GameManagerController>().StartCoroutine("AttackOption", 2);
                    }
                }
                else
                {
                    deckInfo.GetComponent <DeckInformation>().RemoveGold(_option.value);
                    gameManager.GetComponent <GameManagerController>().StartCoroutine("FleeOption", 2);
                }
            }
            break;

        case Enumerations.OptionType.Attack:

            gameManager.GetComponent <GameManagerController>().StartCoroutine("AttackOption", 2);
            break;

        case Enumerations.OptionType.Loot:
            gameManager.GetComponent <GameManagerController>().StartCoroutine("LootOption", 2);
            break;

        case Enumerations.OptionType.Npc:
            if (_option.Add)
            {
            }
            else
            {
            }
            gameManager.GetComponent <GameManagerController>().StartCoroutine("FleeOption", 2);
            break;

        case Enumerations.OptionType.Ignore:
            gameManager.GetComponent <GameManagerController>().StartCoroutine("IgnoreOption", 2);
            break;

        case Enumerations.OptionType.Flee:
            gameManager.GetComponent <GameManagerController>().StartCoroutine("FleeOption", 2);
            break;

        case Enumerations.OptionType.Start:
            gameManager.GetComponent <GameManagerController>().StartCoroutine("StartOption", 1);
            break;
        }
        eventChat.SetActive(false);
    }
Exemplo n.º 4
0
 public void InitializeButtonInfo(GameObject _father, OptionForEvent _option)
 {
     this.father = _father;
     optionInfo  = _option;
     SetOptionText(_option.Title);
 }