Example #1
0
        /// <summary>
        /// The host is always the red player and always on the left side
        /// </summary>
        public void Initialize()
        {
            Entity local;
            Entity remote;

            this.connectionManager = gameManager.NetworkConnectionManager;
            var HostPosition   = new Vector3(10, 45, -10);
            var ClientPosition = new Vector3(-100, 45, 10);

            if (connectionManager.IsHost)
            {
                local = GameEntityFactory.NewLocalPlayer("Models/Blob", 0, HostPosition,
                                                         new Vector3(0, 0, -150), viewport.AspectRatio, true,
                                                         AssetManager.Instance.CreateTexture(Color.Red, gameManager.game.GraphicsDevice));
                GameEntityFactory.NewParticleSettingsEntity(local, 10, 1, "smoke");
                remote = GameEntityFactory.NewBasePlayer("Models/Blob", 1, ClientPosition, AssetManager.Instance.CreateTexture(Color.Blue, gameManager.game.GraphicsDevice), GameEntityFactory.REMOTE_PLAYER);
            }
            else
            {
                local = GameEntityFactory.NewLocalPlayer("Models/Blob", 0, ClientPosition,
                                                         new Vector3(0, 0, -150), viewport.AspectRatio, true,
                                                         AssetManager.Instance.CreateTexture(Color.Blue, gameManager.game.GraphicsDevice));
                GameEntityFactory.NewParticleSettingsEntity(local, 10, 1, "smoke");
                remote = GameEntityFactory.NewBasePlayer("Models/Blob", 1, HostPosition, AssetManager.Instance.CreateTexture(Color.Red, gameManager.game.GraphicsDevice), GameEntityFactory.REMOTE_PLAYER);
            }
            GameEntityFactory.NewOutOfBounds(new Vector3(-10000, -1000, -10000), new Vector3(10000, -50, 10000));
            NetworkHandlingSystem networkSystem = new NetworkHandlingSystem(connectionManager.GetPeer());

            networkSystem.InitPlayers();
            SystemManager.Instance.AddToUpdateables(networkSystem);

            particleSystem = new ParticleSystem(gameManager.game.GraphicsDevice);
            particleSystem.InitializeParticleSystem(ComponentManager.Instance.ConcurrentGetComponentOfEntity <ParticleSettingsComponent>(local));
            particleCreationSystem = new ParticleCreationSystem(particleSystem);
            SystemManager.Instance.AddToDrawables(particleSystem);
            SystemManager.Instance.AddToUpdateables(particleSystem, particleCreationSystem);

            AudioManager.Instance.ClearSongs();
            AudioManager.Instance.EnqueueSongs("playMusic1", "playMusic2");
            InitWorld();
        }
Example #2
0
        public void Initialize()
        {
            var playerEntity = GameEntityFactory.NewLocalPlayer("Models/Blob", 0, new Vector3(10, 45, 0),
                                                                new Vector3(0, 500, -100), viewport.AspectRatio, true,
                                                                AssetManager.Instance.CreateTexture(Color.Red, gameManager.game.GraphicsDevice));

            //GameEntityFactory.NewParticleSettingsEntity(playerEntity, 100, 2, "fire");
            GameEntityFactory.NewParticleSettingsEntity(playerEntity, 10, 1, "smoke");

            GameEntityFactory.NewAiPlayer("Models/Blob", new Vector3(-100, 45, 0),
                                          AssetManager.Instance.CreateTexture(Color.Honeydew, gameManager.game.GraphicsDevice));

            GameEntityFactory.NewOutOfBounds(new Vector3(-10000, -1000, -10000), new Vector3(10000, -50, 10000));
            InitWorld();

            particleSystem = new ParticleSystem(gameManager.game.GraphicsDevice);
            particleSystem.InitializeParticleSystem(ComponentManager.Instance.ConcurrentGetComponentOfEntity <ParticleSettingsComponent>(playerEntity));
            particleCreationSystem = new ParticleCreationSystem(particleSystem);
            SystemManager.Instance.AddToDrawables(particleSystem);
            SystemManager.Instance.AddToUpdateables(particleSystem, particleCreationSystem);

            AudioManager.Instance.ClearSongs();
            AudioManager.Instance.EnqueueSongs("playMusic1", "playMusic2");
        }