Exemplo n.º 1
0
    protected virtual void TransitionToState(Tower.TowerState toState)
    {
        //First transition into acting state triggers immediate action
        if (toState == TowerState.Acting)
        {
            _nextActionTime = Time.time;
        }

        CurrentState = toState;

        UpdateAnimator();
    }
Exemplo n.º 2
0
        private void Spawn(TowerType.Type type, int towerLevel)
        {
            Debug.Log($"type: {type}, level: {towerLevel}");
            var index = (uint)type + (towerLevel - 1) * 3;

            //_towerHeight = towers[index].transform.localScale.y;
            _instantiateTower = Instantiate(
                towers[index],
                PositionHelper.OnTop(transform, 0.2f),
                Quaternion.identity
                );
            _instantiateTowerState       = _instantiateTower.GetComponent <TowerState>();
            _instantiateTowerState.Block = this;
        }
Exemplo n.º 3
0
 public void Awake()
 {
     _state = GetComponent <TowerState>();
 }
Exemplo n.º 4
0
 public void Serialize()
 {
     var towerState = new TowerState();
     towerState.Floors = Floors.Select(x => x.FloorType).ToArray();
     PlayerPrefs.SetString(towerSeriazeConst, JsonUtility.ToJson(towerState));
 }