예제 #1
0
    public void OpenEvent(int _event)
    {
        EventStruct newEvent = EventControl.GetEventStruct(_event);

        eventObject.SetActive(true);
        nameText.text  = newEvent.name;
        eventText.text = newEvent.eventText;

        for (int i = 0; i < newEvent.buttonText.Length; i++)
        {
            buttonText [i].transform.parent.gameObject.SetActive(false);
        }
        for (int i = 0; i < newEvent.buttonText.Length; i++)
        {
            buttonText [i].transform.parent.gameObject.SetActive(true);
            buttonText[i].text = newEvent.buttonText[i];
        }
        currentEvent = _event;
    }
예제 #2
0
    public void EventConsequence(int _event, int _choice)
    {
        EventConsequences newConsequence = EventControl.GetEventStruct(_event).eventConsequences[_choice];



        int nextEvent = newConsequence.nextEvent;

        string _feedbackText = "";

        if (nextEvent > 0)
        {
            OpenEvent(nextEvent);
            return;
        }


        if (newConsequence.newClue)
        {
            main.mainEventProgress++;
            main.NextClue(newConsequence.clueKnown);
            _feedbackText += "\nNew Clue";
        }

        if (newConsequence.money != 0)
        {
            _feedbackText   += "\nUnits " + newConsequence.money.ToString();
            main.ship.money += newConsequence.money;
            if (main.ship.money < 0)
            {
                main.ship.strength -= 1;
                _feedbackText      += " Not Enough Units";
            }
        }
        if (newConsequence.research != 0)
        {
            _feedbackText      += "\nResearch " + newConsequence.research.ToString();
            main.ship.research += newConsequence.research;
        }
        if (newConsequence.strength != 0)
        {
            _feedbackText += "\nStrength " + newConsequence.strength.ToString();

            main.ship.strength += newConsequence.strength;
            if (main.ship.strength > main.ship.maxStrength)
            {
                main.ship.strength = main.ship.maxStrength;
            }
        }

        if (newConsequence.jumpCharges != 0)
        {
            _feedbackText         += "\nJumpCharges " + newConsequence.jumpCharges.ToString();
            main.ship.jumpCharges += newConsequence.jumpCharges;
            if (main.ship.jumpCharges > main.ship.maxJumpCharges)
            {
                main.ship.jumpCharges = main.ship.maxJumpCharges;
            }
        }



        //main.inEvent = false;
        main.SetBlockingCanvas(false, 1);
        //main.shipNavigationUI.SetActive (true);
        eventObject.SetActive(false);

        eventFeedbackObjectText.text = _feedbackText;
        StartCoroutine("EventFeedbackObject");
    }