Esempio n. 1
0
        public override void StartGame()
        {
            if (playerLives < 1)
            {
                playerLives = DEFAULT_PLAYER_LIVES;
            }

            var controls = new Dictionary <string, string>
            {
                { "Fire", "Fire1" },
                { "Horizontal", "Horizontal1" },
                { "Vertical", "Vertical1" }
            };

            var playerObject = spawnManager.SpawnPlayer(this, new Vector2(-3, -3));

            InputController.AssignPlayerControls(playerObject.GetInstanceID(), controls);

            var colliders1 = playerObject.GetComponents <BoxCollider2D>();

            controls = new Dictionary <string, string>
            {
                { "Fire", "Fire2" },
                { "Horizontal", "Horizontal2" },
                { "Vertical", "Vertical2" }
            };

            playerObject = spawnManager.SpawnPlayer(this, new Vector2(3, -3));
            InputController.AssignPlayerControls(playerObject.GetInstanceID(), controls);

            var colliders2 = playerObject.GetComponents <BoxCollider2D>();

            foreach (var c1 in colliders1)
            {
                foreach (var c2 in colliders2)
                {
                    Physics2D.IgnoreCollision(c1, c2);
                }
            }

            ResetStats();
            spawnManager.StartSpawn(this);
            gameView.ShowHighScore(GetHighscore().ToString());
            base.StartGame();
        }
Esempio n. 2
0
        public override void StartGame()
        {
            if (playerLives < 1)
            {
                playerLives = DEFAULT_PLAYER_LIVES;
            }

            var controls = new Dictionary <string, string>
            {
                { "Fire", "Fire1" },
                { "Horizontal", "Horizontal1" },
                { "Vertical", "Vertical1" }
            };

            var playerObject = spawnManager.SpawnPlayer(this, new Vector2(0, -3));

            InputController.AssignPlayerControls(playerObject.GetInstanceID(), controls);

            ResetStats();
            spawnManager.StartSpawn(this);
            gameView.ShowHighScore(GetHighscore().ToString());
            base.StartGame();
        }