/// <summary> /// Extinguishes fire on this instance of grass. /// </summary> public void Extinguish() { if (grassState == GrassState.burning) { grassState = GrassState.normal; UpdateGrassMaterial(); } }
/// <summary> /// Sets this instance of grass on fire. /// </summary> public void SetOnFire() { if (grassState != GrassState.burnt) { nextSpread = Random.Range(MIN_FIRE_SPREAD_TIME, MAX_FIRE_SPREAD_TIME); grassState = GrassState.burning; UpdateGrassMaterial(); } }
protected override void Update() { base.Update(); // =============================================== // 転倒防止。 動くかは要確認 // =============================================== var adjustRot = new Quaternion(0f, transform.rotation.y, 0f, transform.rotation.w); transform.rotation = adjustRot; currentState = stateMachine.CurrentState.identity; }
void Update() { if (grassState == GrassState.burning && Simulation.PlayState == PlaybackState.play) { resistance -= Time.deltaTime * Simulation.PlaybackSpeed; nextSpread -= Time.deltaTime * Simulation.PlaybackSpeed; if (nextSpread <= 0) { SpreadFire(); nextSpread = Random.Range(MIN_FIRE_SPREAD_TIME, MAX_FIRE_SPREAD_TIME); } if (resistance <= 0) { grassState = GrassState.burnt; UpdateGrassMaterial(); } } }
float nextSpread; // time until next spread /// <summary> /// Reset grass state, material and resistance. /// </summary> public void Start() { grassState = GrassState.normal; UpdateGrassMaterial(); resistance = Random.Range(MIN_RESISTANCE_TIME, MAX_RESISTANCE_TIME); }
public StateWander(T owner, GrassState identity) : base(owner, identity) { }
public StatePause(T owner, GrassState identity) : base(owner, identity) { }
public StateDestroy(T owner, GrassState identity) : base(owner, identity) { }
public StatePursuit(T owner, GrassState identity) : base(owner, identity) { }
public StateAttack(T owner, GrassState identity) : base(owner, identity) { }
public StateEscape(T owner, GrassState identity) : base(owner, identity) { }
public MyStateAttack(NigenigeGrass owner, GrassState identity) : base(owner, identity) { }
public MyStateEscape(NigenigeGrass owner, GrassState identity) : base(owner, identity) { }
public MyStateWander(NigenigeGrass owner, GrassState identity) : base(owner, identity) { }
public MyStatePursuit(NigenigeGrass owner, GrassState identity) : base(owner, identity) { }
public MyStateDestory(NigenigeGrass owner, GrassState identity) : base(owner, identity) { }