Exemple #1
0
        //-----------------------------------------------------------------------------------------
        //Building Construction:

        //method called to complete the construction of the building
        private void CompleteConstruction()
        {
            if (building.IsBuilt == true) //if the building has been already constructed
            {
                return;                   //do not proceed
            }
            building.IsBuilt = true;      //mark as built.

            //switch the building states for post construction mode:
            if (constructionCompleteState != null)
            {
                ActivateState(constructionCompleteState);
            }

            activeStates.Clear();
            inactiveStates.Clear();
            builtStates.Reverse();
            foreach (State s in builtStates)
            {
                inactiveStates.Push(s);
            }

            building.ToggleModel(true);             //show the building's model

            CustomEvents.OnBuildingBuilt(building); //custom event

            //if there's a task launcher component attached to the building
            if (building.TaskLauncherComp != null)
            {
                building.TaskLauncherComp.Init(gameMgr, building); //initiliaze it
            }
            building.OnBuilt();                                    //set the building's built settings
        }