예제 #1
0
        public void RespawnClient(ArenaClient client)
        {
            if (Phase < GamePhase.Fight)
            {
                return;
            }

            Vec3f nextStand = Stands[0].Stand.Position;
            // find player closest to next stand
            IEnumerable <Vec3f> positions = StandingPlayers.Select(p => p.Character.GetPosition());

            if (!Vec3f.FindClosest(Stands[0].Stand.Position, positions, out Vec3f best))
            {
                return;
            }

            // two closest respawns to player
            IEnumerable <Vec3f> x = Scenario.Respawns.OrderBy(p => p.GetDistance(best)).Take(2);

            // closest of the two respawns to next stand
            if (!Vec3f.FindClosest(best, x, out Vec3f result))
            {
                return;
            }

            var npc = SpawnCharacter(client, World, result, 100);

            npc.DropUnconscious();
        }