Exemplo n.º 1
0
    //public static Dictionary<string, ObjectPool> objectPools;

    // This is called even before the Start function. I just wanted to perform the DontDestroyOnLoad
    // as early as possible.
    private void Awake()
    {
        //The Services class is just a static class that acts as a list of all the major systems in the game.
        //Right now, Services has three attributes: the gameController (this), the eventManager, and the
        // encounter.
        if (Services.gameController == null)
        {
            Object.DontDestroyOnLoad(this);

            /*
             * flowchartGameObject = GameObject.Find("Flowchart");
             * Object.DontDestroyOnLoad(flowchartGameObject);
             * flowchart = flowchartGameObject.GetComponent<Fungus.Flowchart>();
             */
            cardInfo.ReadFromSpreadsheet();


            Services.gameController = this;
            Services.eventManager   = new EventManager();
            Services.input          = new InputManager();
            InputManager.Initialize();
            //Services.allCardInformation = AllCardInformation(cardSpreadsheet);



            //These lines initialize the public attributes in the GameController
            partyDeck = new DeckList();
            //objectPools = new Dictionary<string, ObjectPool>();

            nextNPC = new Kelly();

            //The gameController state machine is private, because this should be pretty much
            //the only script changing the game state at such a high level.
            _gameFSM = new FiniteStateMachine <GameController>(this);

            partyDeck.AddCard(new Dance());
            partyDeck.AddCard(new Chill());
            partyDeck.AddCard(new Gutsy());

            switch (SceneManager.GetActiveScene().buildIndex)
            {
            case 0:
                _gameFSM.TransitionTo <StartMenu>();
                InputManager.inputFSM.TransitionTo <TitleScreen>();
                break;

            case 1:
                _gameFSM.TransitionTo <PersonalityQuiz>();
                InputManager.inputFSM.TransitionTo <TitleScreen>();
                break;

            case 2:
                _gameFSM.TransitionTo <Story>();
                //InputManager.inputFSM.TransitionTo<PartyMode>();
                partyDeck.AddCard(new Bubbly());                  //These lines add basic cards to the deck
                partyDeck.AddCard(new Dance());
                partyDeck.AddCard(new Gutsy());
                partyDeck.AddCard(new PrivateTalk());
                partyDeck.AddCard(new Chat());
                partyDeck.AddCard(new Encourage());
                partyDeck.CalculateVictoryPoints();
                break;

            case 3:
                _gameFSM.TransitionTo <CardGame>();
                partyDeck.AddCard(new Bubbly());                  //These lines add basic cards to the deck
                partyDeck.AddCard(new Dance());
                partyDeck.AddCard(new Gutsy());
                partyDeck.AddCard(new PrivateTalk());
                partyDeck.AddCard(new Chat());
                partyDeck.AddCard(new Encourage());
                partyDeck.CalculateVictoryPoints();
                break;

            default:
                break;
            }



            //PURELY FOR TESTING THE CARD ENCOUNTER SCENE. In the real game, we don't want to start playing
            // cards right away. Feel free to uncomment if you want to test the card game, but be mindful.

            #region



            //_gameFSM = new FiniteStateMachine<GameController>(this); //This line creates a state machine for
            //_gameFSM.TransitionTo<CardGame>();

            #endregion
        }

        else
        {
            this.enabled = false;
        }
    }