State_Base_AI death_state; // 死亡状態(確保のみ) //-------------------------------------------------------------------- // ● コンストラクタ //-------------------------------------------------------------------- public State_Machine(AI ai, State_Base_AI death_state) { this.ai = ai; this.death_state = death_state; states = new Dictionary <string, State_Base_AI>(); change("Body", new State_Base_AI()); }
//-------------------------------------------------------------------- // ● コンストラクタ //-------------------------------------------------------------------- public State_Loitering_AI(State_Base_AI next_state = null) { this.next_state = next_state; if (next_state == null) { next_wait_second = float.PositiveInfinity; } }
//-------------------------------------------------------------------- // ● コンストラクタ //-------------------------------------------------------------------- public State_Wait_AI(float wait_second = 3, float forcing_wait_second = 0, State_Base_AI next_state = null) { this.wait_second = wait_second; this.forcing_wait_second = forcing_wait_second; this.next_state = next_state != null ? next_state : new State_Base_AI(); }
//-------------------------------------------------------------------- // ● 状態を変更 //-------------------------------------------------------------------- // 部位を指定 public void change(string region_name, State_Base_AI state) { // 前回状態を終了 if (states.ContainsKey(region_name)) { this.state(region_name).finalize(); } states[region_name] = state; // 現在状態に適用 this.state(region_name).ai = ai; // 自身を登録 this.state(region_name).initialize(); // 初期化 }
// 本体のみ public void change(State_Base_AI state) { change("Body", state); }
//-------------------------------------------------------------------- // ● セッター //-------------------------------------------------------------------- // 死亡状態を設定 public void set_death(State_Base_AI death_state) { this.death_state = death_state; }
protected new Dragon ai; // AI本体 //-------------------------------------------------------------------- // ● コンストラクタ //-------------------------------------------------------------------- public State_Wait_Dragon(float wait_second = 3, float forcing_wait_second = 0, State_Base_AI next_state = null) : base(wait_second, forcing_wait_second, next_state) { }