Exemplo n.º 1
0
    /*private int xtra = 0;
     * public void _switch()
     * {
     *  xtra++;
     *  if (xtra > 3)
     *      xtra = 0;
     *  ChangePhase(WorldState.CENTER, (WorldStateExtra)xtra);
     * }*/

    public int Spawn(GOType type, Vector3 pos, int guid = -1, int extra = 0)
    {
        GameObject go;
        int        _guid = -1;

        switch (type)
        {
        case GOType.GO_PLAYER:
            go    = player_pool.Pop(pos, Quaternion.identity);
            _guid = ObjectMgr.Instance.Register(go, type, guid, extra);
            BomberController controller = go.GetComponent <BomberController>();
            controller.ColorIndex = extra;
            break;

        case GOType.GO_BOMB:
            go    = bomb_pool.Pop(pos, Quaternion.identity);
            _guid = ObjectMgr.Instance.Register(go, type, guid, extra);
            break;

        case GOType.GO_PWRUP:
            go = pwr_up_pool.Pop(pos, Quaternion.identity);
            PowerUpGOScript sc = go.GetComponent <PowerUpGOScript>();
            sc.type = (Config.PowerType)extra;
            sc.Init();
            _guid = ObjectMgr.Instance.Register(go, type, guid, extra);
            break;
        }
        if (_guid > 0 && ((GameMgr.Instance.Type & GameMgrType.SERVER) != 0))
        {
            GameMgr.Instance.s.SendPacketBroadCast(PacketBuilder.BuildInstantiateObjPacket(ObjectMgr.Instance.DumpData(_guid)));
        }
        return(_guid);
    }