示例#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();
    }
示例#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;
        }
示例#3
0
 public void Awake()
 {
     _state = GetComponent <TowerState>();
 }
示例#4
0
 public void Serialize()
 {
     var towerState = new TowerState();
     towerState.Floors = Floors.Select(x => x.FloorType).ToArray();
     PlayerPrefs.SetString(towerSeriazeConst, JsonUtility.ToJson(towerState));
 }