Beispiel #1
0
    public void SetState(Dictionary <Type, BuildingBaseState> states)
    {
        _buildingModeStates = states;

        CurrentState              = _buildingModeStates[typeof(DefaultState)];
        CurrentState.OnStateExit += StateChanged;

        if (CurrentState == _buildingModeStates[typeof(BuildWallState)])
        {
            CurrentState.OnBuildModeCellSelected += CellSelected;
        }
    }
Beispiel #2
0
 protected override void Awake()
 {
     base.Awake();
     building         = this;
     spawnPoint       = transform.position;
     navObstacle      = GetComponent <NavMeshObstacle> ();
     activeModel      = GetComponentInChildren <ActiveBuildingModel>();
     destroyedModel   = GetComponentInChildren <DestroyedBuildingModel>(true);
     spawner          = GetComponentInChildren <Spawner>();
     maxBuildProgress = paramManager.MaxHitPoints;
     StoreOriginalMaterials();
     buildingState = new VirtualStateB(building, false);
 }
Beispiel #3
0
        private void SwitchState(BuildingBaseState state)
        {
            Renderer render = GetComponent <Renderer>();

            switch (state)
            {
            case BuildingBaseState.available:
                render.material        = availableMaterial;
                m_curBuildingBaseState = BuildingBaseState.available;
                break;

            case BuildingBaseState.forbidden:
                render.material        = forbiddenMaterial;
                m_curBuildingBaseState = BuildingBaseState.forbidden;
                break;
            }
        }
Beispiel #4
0
 // Use this for initialization
 void Start()
 {
     m_curBuildingBaseState = BuildingBaseState.available;
 }
Beispiel #5
0
 public void SetBuildingState(BuildingBaseState newState)
 {
     buildingState.ExitRoutine(buildingState);
     buildingState = newState;
 }
Beispiel #6
0
 public virtual void ExitRoutine(BuildingBaseState state)
 {
 }
Beispiel #7
0
 public override void ExitRoutine(BuildingBaseState state)
 {
 }