public void RemovePlayer(PlayerSpaceShip i_Player)
 {
     if (m_Players != null)
     {
         m_Players.Remove(i_Player);
     }
 }
        public void RegisterPlayer(PlayerSpaceShip i_Player)
        {
            if (m_Players == null)
            {
                m_Players = new List <PlayerSpaceShip>();
            }

            m_Players.Add(i_Player);
        }
示例#3
0
 private void AddPlayer()
 {
     if (!_playerPrefab)
     {
         throw new NullReferenceException("_playerPrefab is null");
     }
     _player = _playerPrefab.GetInstance();
     if (!_player)
     {
         throw new NullReferenceException("_player is null");
     }
     _player.Initialize();
     _player.transform.position = Vector3.zero;
     _player.transform.rotation = Quaternion.identity;
     _player.OnPlayerShot      += OnPlayerShot;
 }
示例#4
0
        public PlayGameScreen(Game i_Game, LevelTransitionScreeen i_TransitionScreen) : base(i_Game)
        {
            m_FirstLevelTransitionScreen = i_TransitionScreen;
            m_BackGround    = new Background(i_Game, this, @"Sprites\BG_Space01_1024x768", 1);
            m_ShootsManager = new ShootsManager(this.Game);
            m_SoundManager  = SoundEffectsManager.GetInstance(i_Game);
            const bool k_IsFirstPlayer = true;

            PlayerSpaceShip[] players = new PlayerSpaceShip[2];
            players[0] = new PlayerSpaceShip(this.Game, this, m_ShootsManager, k_IsFirstPlayer);
            players[1] = new PlayerSpaceShip(this.Game, this, @"Sprites/Ship02_32x32", m_ShootsManager, !k_IsFirstPlayer);


            EnemyMotherShip       motherShip      = new EnemyMotherShip(this.Game, this, m_ShootsManager);
            EnemySpaceShipsMatrix spaceshipMatrix = new EnemySpaceShipsMatrix(this.Game, this, m_ShootsManager);
            WallMatrix            wallMatrix      = new WallMatrix(this.Game, this, m_ShootsManager);

            m_ShootsManager.EnemyGotShot += players[0].EnemyGotShot;
            m_ShootsManager.EnemyGotShot += players[1].EnemyGotShot;
            m_PauseScreen    = new PauseScreen(this.Game);
            m_GameOverScreen = new GameOverScreen(this.Game, this, m_FirstLevelTransitionScreen);

            m_Players = players;
            r_Enemys  = new List <Sprite>();
            r_Enemys.Add(motherShip);
            r_Enemys.Add(spaceshipMatrix);
            m_WallsMatrix = wallMatrix;
            m_EnemyMatrix = spaceshipMatrix;
            m_Level       = 1;

            this.Add(m_Players[0]);
            this.Add(m_Players[1]);
            this.Add(motherShip);
            this.Add(spaceshipMatrix);
            this.Add(wallMatrix);
            this.Add(m_BackGround);

            List <PlayerSpaceShip> playersList = new List <PlayerSpaceShip>();

            playersList.Add(m_Players[0] as PlayerSpaceShip);
            playersList.Add(m_Players[1] as PlayerSpaceShip);
            m_CollisionManager = new CollisionManager(this.Game, playersList, spaceshipMatrix.Sprites, wallMatrix.Sprites);
        }
 // Start is called before the first frame update
 void Start()
 {
     player = GameObject.FindGameObjectWithTag("PlayerShipTag").GetComponent <PlayerSpaceShip>();
 }
示例#6
0
 private void Start() => playerSpaceShip = GetComponent <PlayerSpaceShip>();