Exemplo n.º 1
0
        //=================================================================================================
        //-----------------------------------Functions-----------------------------------------------------
        //=================================================================================================

        void Start()
        //------------------------------------------------------------------
        //  Start() runs when the object if first instantiated
        //		-Because this object will occur once through the game,
        //			these values are the beginning of game values
        //		-Values should be updated at EndTurn State of StateMachine()
        //-------------------------------------------------------------------
        {
            // Clear the dictionary
            TileDictionary.Clean();

            // Set the dimensions and generate/add the tiles
            TileManager.SetDimensions(64, 20, 16);
            TileManager.GenerateAndAddTiles();

            #region End Scene Initialisation stuff

            // Create the empty game object.
            m_endSceneCharData = new GameObject("EndSceneCharData");

            // Tag it as end scene char data.
            m_endSceneCharData.tag = "EndSceneCharDataTag";

            // Add the end scene char data component.
            m_endSceneCharData.AddComponent <EndSceneData>();

            // Set it to not destroy on load.
            DontDestroyOnLoad(m_endSceneCharData);

            // Defaults to true.
            m_runEndStuff = true;

            #endregion

            //#region Menu Data Initialisation Stuff

            // Get the game object with the menu data tag.
            GameObject menuData = GameObject.FindGameObjectWithTag("MenuDataTag");

            // Only proceed of the data object isn't null.
            if (menuData != null)
            {
                // Get its menu data script.
                MenuData menuDataScript = menuData.GetComponent <MenuData>();

                // Copy the value into the state machine.
                m_GUINumOfPlayers = menuDataScript.NumberPlayers;
            }

            // Finally, destroy the menu data object.
            Destroy(menuData);

            //#endregion

            //initialize empty lists
            m_playerList         = new List <GameObject>();
            m_playerScriptList   = new List <GSP.Char.Character>();
            m_PlayerResourceList = new List <GSP.Char.ResourceList>();

            //Add Players Instances
            AddPlayers(m_GUINumOfPlayers);

            //Beginning State
            m_gamePlayState = GamePlayState.BEGINTURN;

            //get scripts needed
            m_DieScript          = GameObject.FindGameObjectWithTag("DieTag").GetComponent <DieInput>();
            m_GUIMapEventsScript = GameObject.FindGameObjectWithTag("GUIMapEventSpriteTag").GetComponent <GUIMapEvents>();
            m_GUIMovementScript  = GameObject.FindGameObjectWithTag("GUIMovementTag").GetComponent <GSP.GUIMovement>();
            //m_NEWGUIMapEventScript = GameObject.FindGameObjectWithTag ("GUIMapEventSpriteTag").GetComponent<GSP.JAVIERGUI.NewGUIMapEvent>();	//used during testing
            m_MapEventScript     = GameObject.FindGameObjectWithTag("DieTag").GetComponent <GSP.MapEvent>();
            m_GUIBottomBarScript = this.GetComponent <GSP.JAVIERGUI.GUIBottomBar>();

            m_DieScript.Dice.Reseed(System.Environment.TickCount);

            //text for the action button
            m_GUIActionString = "Action\nButton";

            //no map event at start;
            m_MapEventString       = "NOTHING";
            m_MapEventResultString = null;

            //this initializes things after Start()
            m_initAfterStart = true;

            //Init audio
            audioSrc = GameObject.FindGameObjectWithTag("AudioSourceTag");
        }               //END start()