Exemplo n.º 1
0
 public override void Enter(BuildingController entityType)
 {
     if (entityType.Building.CurrentLevel == BuildingLevel.BuildingLevel1)
     {
         entityType.Building.CurrentLevel = BuildingLevel.BuildingLevel2;
         entityType.GetFSM().ChangeState(Building_StateBeforeBuilt.Instance());
     }
     else
     {
         entityType.GetFSM().ChangeState(Building_StateDispatching.Instance());
     }
 }
    private void InitBuilding()
    {
        this.hpbarLength         = 600;
        this.menuShowing         = false;
        this.gameSceneController = GameObject.Find("GameSceneController").GetComponent <GameSceneController>();

        if (this.Building != null)
        {
            this.DispatchIntervalLevel1 = this.Building.ProducedTimeLevel1;
            this.DispatchIntervalLevel2 = this.Building.ProducedTimeLevel2;

            this.m_PStateMachine = new StateMachine <BuildingController>(this);
            this.m_PStateMachine.SetCurrentState(Building_StateBeforeBuilt.Instance());
            this.m_PStateMachine.SetGlobalState(Building_GlobalState.Instance());
        }
    }