Example #1
0
        public GameState(GameStateMachine parent_machine, uint state_id, string state_name, ushort sink_id, StateComposeType sct)
        {
            this.m_parent_machine = parent_machine;
            this.m_state_id       = state_id;
            this.m_state_name     = state_name;
            this.m_sink_id        = sink_id;
            this.m_compose_type   = sct;

            this.m_action_flag     = uint.MaxValue;
            this.m_can_re_enter    = false;
            this.m_is_state_lock   = false;
            this.m_listner         = null;
            this.m_parent_state_id = ushort.MaxValue;
        }
Example #2
0
        private GameState CreateStateImpl(uint state_id, string state_name, ushort sink_id, StateComposeType com_type, uint parent_id)
        {
            GameState state = null;

            GameStateMachine.GameStateSink sink = FindSink(sink_id);
            if (sink != null && state_id < STATE_ID_CAPACITY && m_state_array[(int)state_id] == null)
            {
                if (com_type == StateComposeType.SCT_COMPOSE || com_type == StateComposeType.SCT_NORMAL)
                {
                    state = new GameState(this, state_id, state_name, sink_id, com_type);
                    sink.contain_state_id_list.Add(state_id);
                }
                else if (com_type == StateComposeType.SCT_SUB)
                {
                    GameState parent_state = this.FindState(parent_id);
                    if (parent_state != null && parent_state.GetComposeType() == StateComposeType.SCT_COMPOSE && parent_state.GetSinkId() == sink_id)
                    {
                        state = new GameState(this, state_id, state_name, sink_id, com_type);
                        state.m_parent_state_id = parent_id;
                        parent_state.m_sub_state_id_list.Add(state_id);
                    }
                }
                if (state != null)
                {
                    this.m_state_array[(int)state_id] = state;
                    this.m_free_state_id_list.Remove(state_id);
                }
            }
            return(state);
        }
Example #3
0
 private GameState CreateStateImpl(uint state_id, string state_name, ushort sink_id, StateComposeType com_type)
 {
     return(this.CreateStateImpl(state_id, state_name, sink_id, com_type, ushort.MaxValue));
 }