public void Reset(bool exit = false)
    {
        if (null != c)
        {
            c.Destroy();
        }
        c = null;
        if (null != s)
        {
            s.Destroy();
        }
        if (exit)
        {
            return;
        }

        m_state       = WorldState.CENTER;
        m_state_extra = WorldStateExtra.WORLDSTATE_1;
        TurnCamera(true);

        s    = null;
        type = (GameMgrType)0;
        ObjectMgr.Instance.Clear();
        player_pool.ClearAndRealloc();
        bomb_pool.ClearAndRealloc();
        pwr_up_pool.ClearAndRealloc();
        if (maps != null)
        {
            maps.Clear();
        }
        game_started = false;
        StopAllCoroutines();
        Async.Instance.Restart();
    }
    public static Packet BuildChangePhasePacket(WorldState state, WorldStateExtra extra)
    {
        Packet p = new Packet(2, Opcode.SMSG_CHANGE_PHASE);

        p.Write((byte)state);
        p.Write((byte)extra);
        return(p);
    }
    public void ChangePhase(WorldState state = WorldState.UNKNOWN, WorldStateExtra extra = WorldStateExtra.NONE)
    {
        Debug.Log("Change from " + m_state);
        if (state != WorldState.UNKNOWN)
        {
            m_state       = state;
            m_state_extra = extra;
        }
        else
        {
            m_state = m_state == WorldState.CENTER ? (WorldState)((int)(WorldState.CENTER) + Random.Range(1, 3)) : WorldState.CENTER;
            if (m_state == WorldState.CENTER)
            {
                int rand = Random.Range(0, 3);
                extra = (WorldStateExtra)rand;
                if (extra == m_state_extra)
                {
                    extra++;
                }
                m_state_extra = extra;
            }
            else
            {
                extra = (WorldStateExtra)((int)m_state - 1);
                if (extra == m_state_extra)
                {
                    extra++;
                    m_state = (WorldState)((int)extra + 1);
                }
                m_state_extra = extra;
            }
        }
        Debug.Log("Change to " + m_state);

        IList <GameObject> l = ObjectMgr.Instance.Get(GOType.GO_PLAYER);

        foreach (var a in l)
        {
            a.SendMessage("OnChangePhase", new short[] { (short)m_state, (short)m_state_extra });
        }

        l = ObjectMgr.Instance.Get(GOType.GO_BOMB);
        Debug.Log("size : " + l.Count);
        foreach (var a in l)
        {
            a.SendMessage("OnChangePhase", m_state);
        }
        Debug.Log("change gravity from " + Physics.gravity + " to " + gravityStates[(int)m_state]);
        Physics.gravity = gravityStates[(int)m_state];

        TurnCamera();
        if (s != null)
        {
            s.SendPacketBroadCast(PacketBuilder.BuildChangePhasePacket(m_state, m_state_extra));
        }
    }