コード例 #1
0
        static void SpawnPlayer(ArenaClient client)
        {
            var     charInfo = client.CharInfo;
            NPCInst npc      = new NPCInst(NPCDef.Get(charInfo.BodyMesh == HumBodyMeshs.HUM_BODY_NAKED0 ? "maleplayer" : "femaleplayer"))
            {
                UseCustoms     = true,
                CustomBodyTex  = charInfo.BodyTex,
                CustomHeadMesh = charInfo.HeadMesh,
                CustomHeadTex  = charInfo.HeadTex,
                CustomVoice    = charInfo.Voice,
                CustomFatness  = charInfo.Fatness,
                CustomScale    = new Vec3f(charInfo.BodyWidth, 1.0f, charInfo.BodyWidth),
                CustomName     = charInfo.Name
            };

            foreach (string e in client.HordeClass.Equipment)
            {
                ItemInst item = new ItemInst(ItemDef.Get(e));
                npc.Inventory.AddItem(item);
                npc.EffectHandler.TryEquipItem(item);
            }

            if (client.HordeClass.NeedsBolts)
            {
            }

            npc.Inventory.AddItem(new ItemInst(ItemDef.Get("hptrank")));

            Vec3f  spawnPos = Randomizer.GetVec3fRad(activeDef.SpawnPos, activeDef.SpawnRange);
            Angles spawnAng = Randomizer.GetYaw();

            //npc.TeamID = 0;
            npc.Spawn(activeWorld, spawnPos, spawnAng);
            client.SetControl(npc);
        }