コード例 #1
0
    public static ForceDesc AddForce(int id, int maxNum, Pathea.PeGameMgr.EGameType type)
    {
        if (Pathea.PeGameMgr.IsMultiCoop)
        {
            id = 1;
        }

        if (!Instance.HasForce(id))
        {
            ForceDesc desc = new ForceDesc();
            desc.ID     = id;
            desc.Allies = new List <int>();
            desc.Allies.Add(id);
            desc.EnemyConflict       = true;
            desc.InternalConflict    = false;
            desc.JoinablePlayerCount = maxNum;
            desc.Name = id.ToString();

            switch (type)
            {
            case Pathea.PeGameMgr.EGameType.Cooperation:

                desc.AllyConflict    = true;
                desc.ItemShare       = true;
                desc.ItemUseShare    = true;
                desc.PublicInventory = true;
                desc.Color           = Color.green;
                break;

            case Pathea.PeGameMgr.EGameType.Survive:

                desc.AllyConflict    = false;
                desc.ItemShare       = false;
                desc.ItemUseShare    = false;
                desc.PublicInventory = false;
                desc.Color           = Color.red;
                break;

            case Pathea.PeGameMgr.EGameType.VS:

                desc.AllyConflict    = false;
                desc.ItemShare       = true;
                desc.ItemUseShare    = true;
                desc.PublicInventory = true;
                desc.Color           = Color.red;
                break;
            }

            Instance.AddForceDesc(desc);

            return(desc);
        }

        int index = Instance.GetForceIndex(id);

        if (-1 != index)
        {
            return(Instance.m_Forces[index]);
        }
        else
        {
            return(null);
        }
    }