Example #1
0
        public WarpHole(MessageService_ToServer messageManager,
                        World world,
                        Texture2D Texture,
                        Vector2 Position,
                        int warpIndex,
                        int destinationAreaID)
        {
            _messageManager = messageManager;

            WarpTexture = Texture;

#if DEBUG
            Debugging.AddStack.Push(this.ToString());
#endif
            body          = BodyFactory.CreateCircle(world, ConvertUnits.ToSimUnits(128 / 2), 4);
            body.BodyType = BodyType.Static;

            body.Position = Position;

            body.SleepingAllowed = true;
            body.OnCollision    += body_OnCollision;

            Id = warpIndex;
            DestinationAreaID = destinationAreaID;

            body.UserData = new WarpholeBodyDataObject(this, destinationAreaID);
        }
        public DrawablePortStateManager(
            MessageHandlerID messageHandlerId,
            IClientPlayerInfoManager clientPlayerInfoManager,
            LidgrenNetworkingService networkingService,
            GlobalGameUISingleton globalGameUiSingleton,
            SpriteBatch spriteBatch,
            MessageService_ToServer messageService
            )
            : base(messageHandlerId, clientPlayerInfoManager, networkingService, messageService, GameStateType.Port)
        {
            _drawList = new HashSet <IDraw>();

            // Todo: Make this class use a ViewModel
            WebView      = new PortWebView(globalGameUiSingleton, null);
            _spriteBatch = spriteBatch;

            OutfitForSale = new Dictionary <byte, PortService>(5);

            ShipsInPort = new Dictionary <int, PortShip>(5);

            _synchronousUpdateList.Add(this);
            _messageService = messageService;
            _drawList.Add(this);
            networkingService.RegisterMessageHandler(this, DrawablePortStateManager_ProcessMessage);
        }
 public SpaceStateManager(
     MessageHandlerID messageHandlerId,
     IClientPlayerInfoManager clientPlayerInfoManager,
     IGlobalGameUISingleton globalGameUiSingleton,
     CollisionManager collisionManager,
     INetworkingService networkingService,
     PhysicsManager physicsManager,
     PlayerShipManager playerShipManager,
     ProjectileManager projectileManager,
     SelectionManager selectionManager,
     SimulationManager simulationManager,
     ClientShipManager clientShipManager,
     SpaceManager spaceManager,
     StructureFactoryManager structureFactoryManager,
     TargetingService targetingService,
     TeamManager teamManager,
     WarpHoleManager warpHoleManager,
     MessageService_ToServer messageService,
     FloatyAreaObjectManager floatyAreaObjectManager)
     : base(messageHandlerId, clientPlayerInfoManager, collisionManager, globalGameUiSingleton, networkingService, physicsManager, playerShipManager,
            projectileManager, selectionManager, clientShipManager, simulationManager, structureFactoryManager,
            warpHoleManager, teamManager, targetingService, floatyAreaObjectManager, messageService, GameStateType.Space, new SpaceViewModel(clientShipManager)
            )
 {
     _spaceManager = spaceManager;
     _synchronousUpdateList.Add(_playerShipManager);
 }
Example #4
0
        public ClientShipManager(
            ParticleManager particleManager,
            PlayerShipManager playerShipManager,
            SpriteBatch spriteBatch,
            TextureManager textureManager,
            SimulationManager simulationManager,
            TargetingService targetManager,
            TeamManager teamManager,
            ProjectileManager projectileManager,
            MessageService_ToServer messageService,
            IClientPlayerInfoManager clientPlayerInfoManager,
            bool simulateNPCs)
        {
            _shipList = new Dictionary <int, Ship>();

            _particleManager         = particleManager;
            _playerShipManager       = playerShipManager;
            _spriteBatch             = spriteBatch;
            _textureManager          = textureManager;
            _simulationManager       = simulationManager;
            _targetManager           = targetManager;
            _teamManager             = teamManager;
            _messageService          = messageService;
            _projectileManager       = projectileManager;
            _updateIgnoreList        = new HashSet <int>();
            _simulateNPCs            = simulateNPCs;
            _positionUpdateList      = new HashSet <Ship>();
            _clientPlayerInfoManager = clientPlayerInfoManager;
        }
        public PlayableGameState(MessageHandlerID messageHandlerId, IClientPlayerInfoManager clientPlayerInfoManager,
                                 INetworkingService networkingService,
                                 CollisionManager collisionManager,
                                 PhysicsManager physicsManager,
                                 PlayerShipManager playerShipManager,
                                 ProjectileManager projectileManager,
                                 SelectionManager selectionManager,
                                 ClientShipManager clientShipManager,
                                 SimulationManager simulationManager,
                                 StructureFactoryManager structureFactoryManager,
                                 WarpHoleManager warpholeManager,
                                 TeamManager teamManager,
                                 TargetingService targetingService,
                                 FloatyAreaObjectManager floatyAreaObjectManager,
                                 MessageService_ToServer messageService,
                                 IStructureManager structureManager,
                                 GameStateType stateType
                                 )
            : base(messageHandlerId, clientPlayerInfoManager, networkingService, messageService, playerShipManager, stateType)
        {
            _collisionManager        = collisionManager;
            _physicsManager          = physicsManager;
            _projectileManager       = projectileManager;
            _selectionManager        = selectionManager;
            _clientShipManager       = clientShipManager;
            _simulationManager       = simulationManager;
            _structureFactory        = structureFactoryManager;
            _warpholeManager         = warpholeManager;
            _teamManager             = teamManager;
            _targetingService        = targetingService;
            _floatyAreaObjectManager = floatyAreaObjectManager;
            StructureManager         = structureManager;

            _networkingService.RegisterMessageHandler(this, _playableStateManager_MessageReceived);
        }
 public PlayableGameStateClient(MessageHandlerID messageHandlerId,
                                IClientPlayerInfoManager clientPlayerInfoManager,
                                CollisionManager collisionManager,
                                IGlobalGameUISingleton globalGameUiSingleton,
                                INetworkingService networkingService,
                                PhysicsManager physicsManager,
                                PlayerShipManager playerShipManager,
                                ProjectileManager projectileManager,
                                SelectionManager selectionManager,
                                ClientShipManager clientShipManager,
                                SimulationManager simulationManager,
                                StructureFactoryManager structureFactoryManager,
                                WarpHoleManager warpholeManager,
                                TeamManager teamManager,
                                TargetingService targetingService,
                                FloatyAreaObjectManager floatyAreaObjectManager,
                                MessageService_ToServer messageService,
                                GameStateType stateType,
                                TViewModel viewModel
                                )
     : base(messageHandlerId, clientPlayerInfoManager, networkingService, collisionManager, physicsManager, playerShipManager, projectileManager, selectionManager, clientShipManager, simulationManager, structureFactoryManager, warpholeManager, teamManager, targetingService, floatyAreaObjectManager, messageService, viewModel, stateType)
 {
     ViewModel = viewModel;
     WebView   = (TWebView)Activator.CreateInstance(typeof(TWebView), globalGameUiSingleton, ViewModel);
     SetupUpdateList(_synchronousUpdateList);
 }
Example #7
0
        public static SpaceStateManager BuildSpaceStateManager(int?areaID, IMessenger messenger, INetworkingService _networkingService)
        {
            //Null references, unused by the Simulator
            TextureManager         textureManager        = null;
            SpriteBatch            spriteBatch           = null;
            ParticleManager        particleManager       = null;
            Texture2D              warpholeTexture       = null;
            Texture2D              borderTexture         = null;
            SelectionManager       selectionManager      = null;
            IGlobalGameUISingleton globalGameUISingleton = null;


            MessageService_ToServer  messageService          = new MessageService_ToServer(messenger);
            SimulationManager        simulationManager       = new SimulationManager();
            CollisionManager         collisionManager        = new CollisionManager(messageService);
            PlayerShipManager        playerShipManager       = new PlayerShipManager(messageService);
            IClientPlayerInfoManager clientPlayerInfoManager = new PlayablePlayerInfoManager(playerShipManager);
            TargetingService         targetingService        = new TargetingService();
            TeamManager       teamManager       = new TeamManager(targetingService);
            PhysicsManager    physicsManager    = new PhysicsManager();
            BorderManager     borderManager     = new BorderManager(borderTexture, spriteBatch, physicsManager);
            ProjectileManager projectileManager = new ProjectileManager(particleManager, physicsManager.World, spriteBatch, targetingService, simulationManager, messageService, collisionManager);
            ClientShipManager clientShipManager = new ClientShipManager(particleManager, playerShipManager, spriteBatch, textureManager, simulationManager, targetingService, teamManager, projectileManager, messageService, clientPlayerInfoManager, true);

            clientShipManager.SendPositionUpdates = true;
            StructureFactoryManager structureFactoryManager = new StructureFactoryManager(messageService, physicsManager.World, projectileManager, targetingService, teamManager, null, clientShipManager, null, true);
            WarpHoleManager         warpholeManager         = new WarpHoleManager(messageService, particleManager, physicsManager, clientShipManager, warpholeTexture);
            GravityManager          gravityManager          = new GravityManager(physicsManager);
            SpaceObjectManager      spaceObjectManager      = new SpaceObjectManager(textureManager, messageService, spriteBatch, particleManager, physicsManager);
            SpaceManager            spaceManager            = new SpaceManager(spriteBatch, borderManager, gravityManager, physicsManager, spaceObjectManager, warpholeManager);
            FloatyAreaObjectManager floatyAreaObjectManager = new FloatyAreaObjectManager(physicsManager.World, textureManager, messageService, spriteBatch, particleManager);

            var mhi = areaID == null ? new MessageHandlerID() : new MessageHandlerID((int)areaID);



            SpaceStateManager spaceStateManager = new SpaceStateManager(mhi,
                                                                        clientPlayerInfoManager,
                                                                        globalGameUISingleton,
                                                                        collisionManager,
                                                                        _networkingService,
                                                                        physicsManager,
                                                                        playerShipManager,
                                                                        projectileManager,
                                                                        selectionManager,
                                                                        simulationManager,
                                                                        clientShipManager,
                                                                        spaceManager,
                                                                        structureFactoryManager,
                                                                        targetingService,
                                                                        teamManager,
                                                                        warpholeManager,
                                                                        messageService,
                                                                        floatyAreaObjectManager);

            spaceStateManager.SetAreaId(areaID);

            return(spaceStateManager);
        }
Example #8
0
 public FloatyAreaObjectManager(World world, TextureManager textureManager, MessageService_ToServer messageService, SpriteBatch spriteBatch, ParticleManager particleManager)
 {
     _world           = world;
     _textureManager  = textureManager;
     _spriteBatch     = spriteBatch;
     _messageService  = messageService;
     _particleManager = particleManager;
 }
 public ActivePlayerGameState(MessageHandlerID messageHandlerId,
                              IClientPlayerInfoManager clientPlayerInfoManager,
                              INetworkingService networkingService,
                              MessageService_ToServer messageService,
                              PlayerShipManager playerShipManager,
                              GameStateType stateType)
     : base(messageHandlerId, clientPlayerInfoManager, networkingService, messageService, stateType)
 {
     _playerShipManager = playerShipManager;
 }
Example #10
0
        public static PlanetStateManager BuildPlanetStateManager(int?areaID, IMessenger messenger, INetworkingService _networkingService, PhysicsConfig _physicsConfig)
        {
            //Null references, unused by the Simulator
            TextureManager   textureManager   = null;
            SpriteBatch      spriteBatch      = null;
            ParticleManager  particleManager  = null;
            Texture2D        warpholeTexture  = null;
            SelectionManager selectionManager = null;


            MessageService_ToServer  messageService          = new MessageService_ToServer(messenger);
            SimulationManager        simulationManager       = new SimulationManager();
            CollisionManager         collisionManager        = new CollisionManager(messageService);
            PlayerShipManager        playerShipManager       = new PlayerShipManager(messageService);
            IClientPlayerInfoManager clientPlayerInfoManager = new PlayablePlayerInfoManager(playerShipManager);
            TargetingService         targetingService        = new TargetingService();
            TeamManager       teamManager       = new TeamManager(targetingService);
            PhysicsManager    physicsManager    = new PhysicsManager();
            ProjectileManager projectileManager = new ProjectileManager(particleManager, physicsManager.World, spriteBatch, targetingService, simulationManager, messageService, collisionManager);
            ClientShipManager clientShipManager = new ClientShipManager(particleManager, playerShipManager, spriteBatch, textureManager, simulationManager, targetingService, teamManager, projectileManager, messageService, clientPlayerInfoManager, true);

            clientShipManager.SendPositionUpdates = true;
            StructureFactoryManager structureFactoryManager = new StructureFactoryManager(messageService, physicsManager.World, projectileManager, targetingService, teamManager, null, clientShipManager, null, true);
            WarpHoleManager         warpholeManager         = new WarpHoleManager(messageService, particleManager, physicsManager, clientShipManager, warpholeTexture);

            FloatyAreaObjectManager floatyAreaObjectManager = new FloatyAreaObjectManager(physicsManager.World, textureManager, messageService, spriteBatch, particleManager);

            var mhi = areaID == null ? new MessageHandlerID() : new MessageHandlerID((int)areaID);

            PlanetStateManager planetStateManager = new PlanetStateManager(
                mhi,
                clientPlayerInfoManager,
                null,
                collisionManager,
                physicsManager,
                playerShipManager,
                projectileManager,
                clientShipManager,
                structureFactoryManager,
                warpholeManager,
                _networkingService,
                selectionManager,
                simulationManager,
                targetingService,
                teamManager,
                GameStateType.Planet,
                floatyAreaObjectManager, messageService,
                _physicsConfig.PlanetTileWidth, _physicsConfig.PlanetTileHeight);

            planetStateManager.SetAreaId(areaID);

            return(planetStateManager);
        }
Example #11
0
        public FloatyAreaObject(int galaxyID, World world, MessageService_ToServer messageService, FloatyAreaObjectTypes type, Texture2D drawTex, Vector2 position, float rotation)
        {
            Id = galaxyID;
            _messageService = messageService;

            DrawColor = Color.Lime;
            Type      = type;


            DrawTex = drawTex;

            CreateBody(world, position, rotation);
        }
Example #12
0
 public WarpHoleManager(MessageService_ToServer messageManager,
                        ParticleManager particleManager,
                        PhysicsManager physicsManager,
                        ClientShipManager clientShipManager,
                        Texture2D warpholeTexture)
 {
     _messageManager    = messageManager;
     _particleManager   = particleManager;
     _physicsManager    = physicsManager;
     _clientShipManager = clientShipManager;
     WarpholeTexture    = warpholeTexture;
     Warpholes          = new List <WarpHole>();
 }
Example #13
0
 public NetworkedGameState(MessageHandlerID messageHandlerId,
                           IClientPlayerInfoManager playerInfoManager,
                           INetworkingService networkingService,
                           MessageService_ToServer messageService,
                           GameStateType stateType)
     : base(stateType)
 {
     _clientPlayerInfoManager = playerInfoManager;
     _messageHandlerID        = messageHandlerId;
     _networkingService       = networkingService;
     _synchronousUpdateList.Add(this);
     _networkingService.RegisterMessageHandler(this, _networkedGameState_MessageReceived);
     _MessageService = messageService;
 }
        public GameStateNetworkingManager(
            int managerID,
            IGameStateManager gameStateManager,
            LidgrenNetworkingService networkingService,
            MessageService_ToServer messageManager
            )
        {
            _gameStateManager  = gameStateManager;
            _networkingService = networkingService;
            _messageManager    = messageManager;

            _messageHandlerID = new MessageHandlerID(managerID);


            _networkingService.RegisterMessageHandler(this, _GameStateNetworkingManager_MessageReceived);
        }
Example #15
0
 /// <summary>
 /// Manages all aspects of Planetary Invasion.
 /// </summary>
 /// <param name="Content">Content Manager</param>
 /// <param name="planetLevel">Level to play on.</param>
 public PlanetStateManager(MessageHandlerID messageHandlerId,
                           IClientPlayerInfoManager clientPlayerInfoManager,
                           IGlobalGameUISingleton globalGameUiSingleton,
                           CollisionManager collisionManager,
                           PhysicsManager physicsManager,
                           PlayerShipManager playerShipManager,
                           ProjectileManager projectileManager,
                           ClientShipManager clientShipManager,
                           StructureFactoryManager structureFactoryManager,
                           WarpHoleManager warpholeManager,
                           INetworkingService networkingService,
                           SelectionManager selectionManager,
                           SimulationManager simulationManager,
                           TargetingService targetService,
                           TeamManager teamManager,
                           GameStateType stateType,//Should be moon or planet
                           FloatyAreaObjectManager floatyAreaObjectManager,
                           MessageService_ToServer messageService,
                           int wallTexWidth, int wallTexHeight)
     : base(messageHandlerId,
            clientPlayerInfoManager,
            collisionManager,
            globalGameUiSingleton,
            networkingService,
            physicsManager,
            playerShipManager,
            projectileManager,
            selectionManager,
            clientShipManager,
            simulationManager,
            structureFactoryManager,
            warpholeManager,
            teamManager,
            targetService,
            floatyAreaObjectManager,
            messageService,
            stateType,
            new PlanetViewModel(clientShipManager)
            )
 {
     _wallWidth  = wallTexWidth;
     _wallHeight = wallTexHeight;
     _synchronousUpdateList.Add(_playerShipManager);
     _messageService = messageService;
 }
Example #16
0
        }                                                 //Need to set this properly

        public Turret(
            MessageService_ToServer messageService,
            ProjectileManager projectileManager,
            Texture2D baseTexture,
            Texture2D headTexture,
            ClientShipManager clientShipManager,
            SpriteBatch spriteBatch,
            World w,
            Vector2 position,
            StructureTypes type,
            float health,
            int ID,
            int seed,
            TurretTypes turretType,
            HashSet <int> teams)
            : base(spriteBatch, headTexture, position.X, position.Y, StructureTypes.LaserTurret, health, ID, teams)
        {
            _messageService = messageService;
            Debugging.AddStack.Push(this.ToString());
            _body              = BodyFactory.CreateRectangle(w, .5f, .5f, 1, position);
            _body.IsStatic     = true;
            _body.UserData     = new StructureBodyDataObject(BodyTypes.Turret, this);
            _body.OnCollision += OnCollision;


            r = new Random(seed); // Sets a seed so that turrets fire at different times.

            _projectileManager = projectileManager;
            _clientShipManager = clientShipManager;

            Weapon = new TurretAltLaser(projectileManager, this, 1);
            Console.WriteLine(ID);

            Texture     = headTexture;
            BaseTexture = baseTexture;

            PotentialTargets = new Dictionary <int, ITargetable>();

            Teams = teams;

            IsBodyValid = true;

            TurretType = turretType;
        }
Example #17
0
        double _shortClickTime = 300;//ms, Minimum amount of time before button is considered "held"

        public SelectionManager(
            TextDrawingService textDrawingService,
            SpriteBatch spriteBatch,
            ClientShipManager clientShipManager,
            MessageService_ToServer messageManager,
            PhysicsManager physicsManager,
            PlayerShipManager playerShipManager,
            TargetingService targetingService,
            UIConversionService uiConversionService)
        {
            _textDrawingService  = textDrawingService;
            _spriteBatch         = spriteBatch;
            _clientShipManager   = clientShipManager;
            _messageManager      = messageManager;
            _physicsManager      = physicsManager;
            _playerShipManager   = playerShipManager;
            _targetingManager    = targetingService;
            _uiConversionService = uiConversionService;
        }
Example #18
0
        private int drawRad = 700;//Radius from cam center to draw stuff

        public SpaceObjectManager(TextureManager textureManager,
                                  MessageService_ToServer messageService,
                                  SpriteBatch spriteBatch,
                                  ParticleManager particleManager,
                                  PhysicsManager physicsManager)
        {
            _particleManager = particleManager;
            _physicsManager  = physicsManager;
            _spriteBatch     = spriteBatch;
            _textureManager  = textureManager;
            _messageService  = messageService;

            oneSecondTimer = 0;



            _updatePlanets       = true;
            planetAmountToUpdate = 5;
        }
        public DrawableColonyStateManager(MessageHandlerID messageHandlerId,
                                          GlobalGameUISingleton globalGameUiSingleton,
                                          LidgrenNetworkingService networkingService,
                                          IClientPlayerInfoManager clientPlayerInfoManager,
                                          SpriteBatch spriteBatch,
                                          MessageService_ToServer messageService,
                                          GameWindow gameWindow
                                          )
            : base(messageHandlerId, clientPlayerInfoManager, networkingService, messageService, GameStateType.Colony)
        {
            _drawList    = new HashSet <IDraw>();
            _spriteBatch = spriteBatch;
            Camera       = new Camera2D(gameWindow);
            WebView      = new ColonyWebView(globalGameUiSingleton, null);

            _synchronousUpdateList.Add(this);
            _messageService = messageService;
            _drawList.Add(this);
            networkingService.RegisterMessageHandler(this, DrawableColonyStateManager_ProcessMessage);
        }
Example #20
0
        public LoginStateManager(
            LoginConfig loginConfig,
            ClientManager clientManager,
            GlobalGameUISingleton globalGameUiSingleton,
            MessageService_ToServer messageService,
            LidgrenNetworkingService networkingService)
            : base(null, null, networkingService, messageService, GameStateType.Login)
        {
            _clientManager = clientManager;

            // Todo: Unfuck this
            WebView = new PortWebView(globalGameUiSingleton, null);

            _loginConfig = loginConfig;

            //_gameStateManager = gameStateManager;

            networkingService.RegisterMessageHandler(this, _loginStateManager_MessageReceived);

            this._asynchronousUpdateList.Add(this);
        }
Example #21
0
        public DefensiveMine(World w, SpriteBatch spriteBatch, int ID, MessageService_ToServer messageService, HashSet <int> teamIDs, Vector2 position, float rotation, Texture2D blinkOffTex, Texture2D blinkOnTex, ProjectileManager pm)
            : base(spriteBatch, blinkOffTex, position.X, position.Y, StructureTypes.DefensiveMine, 100, ID, teamIDs)
        {
            _blinkOnTex  = blinkOnTex;
            _blinkOffTex = blinkOffTex;

            TerminationEffect = ParticleEffectType.ExplosionEffect;
            _messageService   = messageService;

            CreateBodies(w, position, rotation);

            Weapon = new MineWeapon(pm, this, 0);

            Teams  = teamIDs;
            _world = w;



            //Randomly stagger blinking
            _blinkOffset = r.Next(0, (int)_blinkOffDuration) + TimeKeeper.MsSinceInitialization;
        }
 public StructureFactoryManager(
     MessageService_ToServer messageManager,
     World world,
     ProjectileManager projectileManager,
     TargetingService targetManager,
     TeamManager teamManager,
     TextureManager textureManager,
     ClientShipManager clientShipManager,
     SpriteBatch spriteBatch,
     bool simulateStructures
     )
 {
     _random             = new Random();
     _messageManager     = messageManager;
     _world              = world;
     _projectileManager  = projectileManager;
     _targetManager      = targetManager;
     _teamManager        = teamManager;
     _textureManager     = textureManager;
     _clientShipManager  = clientShipManager;
     _spriteBatch        = spriteBatch;
     _simulateStructures = simulateStructures;
 }
Example #23
0
        protected override MainManager _manualBuild()
        {
            #region Singletons
            ClientManager clientManager = new ClientManager(new CoreNetworkConfig());
            CameraService cameraService = new CameraService();

            TextDrawingService textDrawingService = null;
            BloomComponent     bloom = null;



            LidgrenMessenger        messenger      = new LidgrenMessenger(clientManager);
            MessageService_ToServer messageService = new MessageService_ToServer(messenger);



            LidgrenNetworkingService networkingService = new LidgrenNetworkingService();


            // Force the static to initialize now
            Utilities.NextUnique();

            #endregion

            List <IGameState> gameStates = new List <IGameState>();

            gameStates.Add(BotStateBuilder.BuildPlanetStateManager(clientManager, networkingService, new PhysicsConfig()));
            gameStates.Add(BotStateBuilder.BuildSpaceStateManager(clientManager, networkingService));
            gameStates.Add(_buildLoginStateManager(null, clientManager, messageService, networkingService));

            NewChatManager chatManager = new NewChatManager(clientManager);

            GameStateManager      gameStateManager      = BuildGameStateManager(cameraService, gameStates, textDrawingService, null);
            MainNetworkingManager mainNetworkingManager = new MainNetworkingManager(chatManager, clientManager, networkingService);

            return(new MainManager(bloom, textDrawingService, this, gameStateManager, _graphics, mainNetworkingManager));
        }
Example #24
0
        public ProjectileManager(ParticleManager particleManager,
                                 World world,
                                 SpriteBatch spriteBatch,
                                 TargetingService targetingManager,
                                 SimulationManager simulationManager,
                                 MessageService_ToServer messageService,
                                 CollisionManager collisionManager
                                 )
        {
            _particleManager   = particleManager;
            _world             = world;
            _spriteBatch       = spriteBatch;
            _targetingManager  = targetingManager;
            _simulationManager = simulationManager;
            _messageService    = messageService;
            _collisionManager  = collisionManager;

            _projectileList = new List <IProjectile>(1000);

            //TODO: Get rid of this nonsense
            _flyweights = new Dictionary <ProjectileTypes, ProjectileStats>();
            _flyweights.Add(ProjectileTypes.Laser, new LaserProjectileStats());
            _flyweights.Add(ProjectileTypes.LaserWave, new LaserWaveProjectileStats());
            _flyweights.Add(ProjectileTypes.PlasmaCannon, new PlasmaCannonProjectileStats());
            _flyweights.Add(ProjectileTypes.NaniteLauncher, new NaniteLauncherProjectileStats());
            _flyweights.Add(ProjectileTypes.AmbassadorMissile, new AmbassadorProjectileStats());
            _flyweights.Add(ProjectileTypes.HellHoundMissile, new HellhoundProjectileStats());
            _flyweights.Add(ProjectileTypes.MissileType1, new MissileType1ProjectileStats());
            _flyweights.Add(ProjectileTypes.MissileType2, new MissileType2ProjectileStats());
            _flyweights.Add(ProjectileTypes.MissileType3, new MissileType3ProjectileStats());
            _flyweights.Add(ProjectileTypes.MissileType4, new MissileType4ProjectileStats());

            _flyweights.Add(ProjectileTypes.BC_Laser, new BC_LaserProjectileStats());
            _flyweights.Add(ProjectileTypes.GravityBomb, new GravityBombProjectileStats());
            _flyweights.Add(ProjectileTypes.MineSplash, new MineSplashProjectileStats());
        }
Example #25
0
        public SpaceGameView(
            MessageService_ToServer messageService,
            BackgroundManager background,
            BloomComponent bloom,
            Camera2D camera,
            ParticleManager particleManager,
            ProjectileManager projectileManager,
            ClientShipManager clientShipManager,
            SpaceManager spaceManager,
            SpaceObjectManager spaceObjectManager,
            SpriteBatch spriteBatch,
            UIConversionService uiConversionService,
            FloatyAreaObjectManager floatyAreaObjectManager,
            SpaceViewModel viewModel,
            GlobalGameUI globalGameUi
            )
        {
            _background              = background;
            _bloom                   = bloom;
            _particleManager         = particleManager;
            _projectileManager       = projectileManager;
            _clientShipManager       = clientShipManager;
            _spaceObjectManager      = spaceObjectManager;
            _spaceManager            = spaceManager;
            _spriteBatch             = spriteBatch;
            _uiConversionService     = uiConversionService;
            _spaceViewModel          = viewModel;
            _floatyAreaObjectManager = floatyAreaObjectManager;
            _messageService          = messageService;


            globalGameUi.RegisterCallbackVoid("ChangeZoom", ChangeZoom);

            Camera      = camera;
            Camera.Zoom = 1f;
        }
Example #26
0
 protected LoginStateManager _buildLoginStateManager(GlobalGameUISingleton globalGameUiSingleton, ClientManager clientManager, MessageService_ToServer messageService, LidgrenNetworkingService networkingService)
 {
     return(new LoginStateManager(_LoginConfig, clientManager, globalGameUiSingleton, messageService, networkingService));
 }
Example #27
0
        public DrawablePlanetStateManager(
            SpriteBatch spriteBatch,
            IClientPlayerInfoManager clientPlayerInfoManager,
            CollisionManager collisionManager,
            GlobalGameUISingleton globalGameUiSingleton,
            ParticleManager particleManager,
            PhysicsManager physicsManager,
            PlayerShipManager playerShipManager,
            ProjectileManager projectileManager,
            ClientShipManager clientShipManager,
            StructureFactoryManager structureFactoryManager,
            TextureManager textureManager,
            INetworkingService networkingService,
            SelectionManager selectionManager,
            SimulationManager simulationManager,
            TargetingService targetService,
            TeamManager teamManager,
            GameStateType stateType,//Should be planet or moon
            UIConversionService uiConversionService,
            WarpHoleManager warpholeManager,
            GameWindow window,
            FloatyAreaObjectManager floatyAreaObjectManager,
            MessageService_ToServer messageService,
            int tileWidth, int tileHeight)
            : base(null,
                   clientPlayerInfoManager,
                   globalGameUiSingleton,
                   collisionManager,
                   physicsManager,
                   playerShipManager,
                   projectileManager,
                   clientShipManager,
                   structureFactoryManager,
                   warpholeManager,
                   networkingService,
                   selectionManager,
                   simulationManager,
                   targetService,
                   teamManager,
                   stateType,
                   floatyAreaObjectManager,
                   messageService,
                   tileWidth,
                   tileHeight)
        {
            _spriteBatch     = spriteBatch;
            _textureManager  = textureManager;
            _particleManager = particleManager;
            Camera           = new Camera2D(window);
            Camera.Zoom      = 1f;
            //ViewModel = new PlanetViewModel(clientShipManager);
            _planetGameView = new PlanetGameView(
                Camera,
                uiConversionService,
                particleManager,
                ViewModel,
                projectileManager,
                clientShipManager,
                spriteBatch,
                textureManager,
                floatyAreaObjectManager,
                globalGameUiSingleton.GameUI,
                SendStructurePlacementRequest);

            _spriteBatch = spriteBatch;

            globalGameUiSingleton.GameUI.RegisterCallbackVoid("SendStructurePlacementRequest", SendStructurePlacementRequest);

            _viewUpdateList.Add(_planetGameView);

            _drawList = new HashSet <IDraw>();
            _drawList.Add(_planetGameView);



            _synchronousUpdateList.Add(_particleManager);
        }
Example #28
0
        public float DockRequestCooldown = 200;//TODO: throw into a config somewhere

        public Port(MessageService_ToServer messageService)
            : base(messageService)
        {
        }
 public PlayerShipManager(MessageService_ToServer messageService)
 {
     _messageService = messageService;
 }
Example #30
0
        public DrawableSpaceStateManager(
            MessageService_ToServer messageService,
            IClientPlayerInfoManager clientPlayerInfoManager,
            BackgroundManager backgroundManager,
            BloomComponent bloom,
            CollisionManager collisionManager,
            Game game,
            GameWindow window,
            GlobalGameUISingleton globalGameUiSingleton,
            LidgrenNetworkingService networkingService,
            SpriteBatch spriteBatch,
            ParticleManager particleManager,
            PhysicsManager physicsManager,
            PlayerShipManager playerShipManager,
            ProjectileManager projectileManager,
            SelectionManager selectionManager,
            SimulationManager simulationManager,
            ClientShipManager clientShipManager,
            SpaceManager spaceManager,
            StructureFactoryManager structureFactoryManager,
            TextureManager textureManager,
            TargetingService targetingService,
            TeamManager teamManager,
            WarpHoleManager warpHoleManager,
            SpaceObjectManager spaceObjectManager,
            UIConversionService uiConversionService,
            FloatyAreaObjectManager floatyAreaObjectManager)
            : base(null, clientPlayerInfoManager, globalGameUiSingleton,
                   collisionManager, networkingService, physicsManager, playerShipManager,
                   projectileManager, selectionManager, simulationManager, clientShipManager, spaceManager, structureFactoryManager, targetingService,
                   teamManager, warpHoleManager, messageService, floatyAreaObjectManager)
        {
            _bloom               = bloom;
            _spriteBatch         = spriteBatch;
            _textureManager      = textureManager;
            _uiConversionService = uiConversionService;
            _spriteBatch         = spriteBatch;
            _particleManager     = particleManager;


            Camera      = new Camera2D(window);
            Camera.Zoom = 1f;

            //ViewModel = new SpaceViewModel(ClientShipManager);
            _spaceGameView = new SpaceGameView(
                messageService,
                backgroundManager,
                bloom,
                Camera,
                particleManager,
                projectileManager,
                clientShipManager,
                spaceManager,
                spaceObjectManager,
                spriteBatch,
                uiConversionService,
                floatyAreaObjectManager,
                ViewModel,
                globalGameUiSingleton.GameUI);

            _viewUpdateList.Add(_spaceGameView);

            _drawList = new HashSet <IDraw>();
            _drawList.Add(_spaceGameView);

            _synchronousUpdateList.Add(_particleManager);
        }