public GameState() { this.Players = new Interfaces.Player.IPlayer[] { new Player.Player("A", new Units.Nation("TestNation", "", new Interfaces.Units.IUnitDescription[] { TestUnit }), 100), new Player.Player("B", new Units.Nation("TestNation", "", new Interfaces.Units.IUnitDescription[] { TestUnit }), 100) }; this.Entities = new EntitiesManager(null); this.Map = new Maps.DefaultMap(); this.Units = new List<Interfaces.Units.IUnit>(); this.Resources = new List<Interfaces.Map.IResourceOnMap>(); }
public override void OnInit() { Logger.Info("Starting game with controller {0} and players {1} and {2}", this.MainSettings.Controller.GetType().Name, this.Players[0].Name, this.Players[1].Name); base.OnInit(); this.StaticEntities = new ClashEngine.NET.EntitiesManager.EntitiesManager(this.GameInfo); this.Controller.GameState = this; this.MainSettings.VictoryRules.GameState = this; this.Controller.PreGameStarted(); this.Players[0].Type = PlayerType.First; this.PlayerControllers[0].Player = this.Players[0]; this.PlayerControllers[0].GameState = this; this.PlayerControllers[0].Initialize(this.OwnerManager, this.GameInfo.MainWindow.Input); this.Players[1].Type = PlayerType.Second; this.PlayerControllers[1].Player = this.Players[1]; this.PlayerControllers[1].GameState = this; this.PlayerControllers[1].Initialize(this.OwnerManager, this.GameInfo.MainWindow.Input); float h = NET.Settings.ScreenSize * (Configuration.Instance.WindowSize.Height / (float)Configuration.Instance.WindowSize.Width); var cam = new ClashEngine.NET.Graphics.Cameras.Movable2DCamera(new OpenTK.Vector2(NET.Settings.ScreenSize, h), new System.Drawing.RectangleF(0f, 0f, this.Map.Size.X, Math.Max(this.Map.Size.Y + NET.Settings.MapMargin, h))); this.Camera = cam; this.StaticEntities.Add(cam.GetCameraEntity(Configuration.Instance.CameraSpeed)); this.StaticEntities.Add(this.Map); this.StaticEntities.Add(new Player.PlayerEntity(this.Players[0], this)); this.StaticEntities.Add(new Player.PlayerEntity(this.Players[1], this)); //Od tej chwili to kontroler jest odpowiedzialny za wszystko. this.Controller.GameStarted(); Logger.Info("Game started"); }
/// <summary> /// Inicjalizuje grę. /// </summary> /// <param name="mp">Główny obiekt gry.</param> public MultiplayerGameState(IMultiplayer mp) { this.Game = mp; this.Entities = new ClashEngine.NET.EntitiesManager.EntitiesManager(mp.GameInfo); this.VictoryRules = System.Activator.CreateInstance(ServerConfiguration.Instance.VictoryRules) as IVictoryRules; this.Controller = System.Activator.CreateInstance(ServerConfiguration.Instance.GameController) as IGameController; this.Settings = ServerConfiguration.Instance.ControllerSettings; this.Map = new Maps.DefaultMap(); }
public EntitiesController(IEntitiesManager <TModel, TViewModel> manager) { _manager = manager; }