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