Ejemplo n.º 1
0
        //Initialize variables
        void Start()
        {
            m_programState = OVERALLSTATES.INTRO;                       //Initial beginning of game
            m_menuState    = MENUSTATES.HOME;                           //Prevents triggers from occuring before called
            timeHolder     = Time.time + 3.0f;                          //Initialize first wait period
            menuCreated    = false;                                     //Menu has not been created yet
            m_mapSelection = "nothing";                                 //Nothing has been chosen yet
            mapsCreated    = false;                                     //Map selection has not been created yet

            #region Menu Data Initialisation Stuff

            // Create the empty game object.
            m_menuData = new GameObject("MenuData");

            // Tag it as menu data.
            m_menuData.tag = "MenuDataTag";

            // Add the menu data component.
            m_menuData.AddComponent <MenuData>();

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

            // Get the menu data object's script.
            m_menuDataScript = m_menuData.GetComponent <MenuData>();

            #endregion

            //Create Intro Background
            introBackground     = new GameObject("IntroBackground");
            introBackground.tag = "IntroBackground";
            var spriteRender = introBackground.AddComponent <SpriteRenderer>();
            spriteRender.sprite = SpriteReference.spriteIntroBackground;
            SpriteReference.ResizeSpriteToScreen(introBackground, Camera.main, 1, 1);
        }         //end Start
Ejemplo n.º 2
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()