예제 #1
0
 public override void OnMouseClick()
 {
     if (PortalComp != null)        //if the building has portal component
     {
         PortalComp.OnMouseClick(); //trigger the click on the portal component
     }
     else
     {
         base.OnMouseClick(); //otherwise, normal mouse click
     }
 }
예제 #2
0
        //a method called when the building is fully constructed
        public void OnBuilt()
        {
            if (PortalComp) //activate portal component if it exists
            {
                PortalComp.Init(gameMgr, this);
            }

            if (free == true) //if this is a free building then stop here
            {
                return;
            }

            if (BorderComp)                     //if the building includes the border component
            {
                BorderComp.Init(gameMgr, this); //activate the border
                CurrentCenter = BorderComp;     //make the building its own center.
            }
            if (DropOffComp)                    //if the building has a drop off component
            {
                DropOffComp.Init(this);         //initiliaze it
            }
            if (GeneratorComp)                  //if there's a generator component, init it
            {
                GeneratorComp.Init(gameMgr, this);
            }

            gameMgr.GetFaction(factionID).UpdateMaxPopulation(addPopulation); //update the faction population slots.

            ToggleResourceBonus(true);                                        //apply the resource bonus

            if (gotoPosition != null)                                         //If the building has a goto position
            {
                if (selection.IsSelected)                                     //Check if the building is currently selected
                {
                    gotoPosition.gameObject.SetActive(true);                  //then show the goto pos
                }
                else
                {
                    gotoPosition.gameObject.SetActive(false); //hide the goto pos
                }
            }
        }