using System; using System.Collections.Generic; using System.Linq; using LuckerGame.Components.Lucker.Cameras; using LuckerGame.Entities; using Sandbox; namespace LuckerGame.Minigames.FpsTest; [Library("mg_fps_test")] public class FpsTestMinigame : Minigame { public override string Name => "FPS Test"; private List Players { get; set; } public override void Initialize( List players ) { Players = players; Players.ForEach( player => { player.Components.Create(); Pawn fpsPawn = new Pawn(); fpsPawn.SetupOwner(player); player.Pawn = fpsPawn; // Get all of the spawnpoints var spawnpoints = Entity.All.OfType(); // chose a random one var randomSpawnPoint = spawnpoints.OrderBy( x => Guid.NewGuid() ).FirstOrDefault(); // if it exists, place the pawn there if ( randomSpawnPoint != null ) { var tx = randomSpawnPoint.Transform; tx.Position = tx.Position + Vector3.Up * 50.0f; // raise it up player.Position = tx.Position; } } ); } public override void Tick() { } public override void Cleanup() { } }