Example #1
0
        /// <summary>
        /// coroutine that Kills the player, stops the camera and resets the game points
        /// </summary>
        /// <returns>The player I.</returns>
        /// <param name="player">Player.</param>
        protected virtual IEnumerator killPlayerIE(PlayableCharacter player)
        {
            LevelManager.Instance.CurrentPlayablePlayers.Remove(player);
            player.Die();

            yield return(new WaitForSeconds(0.0f));

            //if last player trigger all players are dead coroutine
            if (LevelManager.Instance.CurrentPlayablePlayers.Count == 0)
            {
                AllPlayersDead();
            }
        }
Example #2
0
        /// <summary>
        /// Inits the game players.
        /// </summary>
        protected virtual void InitGamePlayers()
        {
            CurrentPlayablePlayers = new List <PlayableCharacter> ();


            for (int i = 0; i < PlayablePlayers.Count; i++)
            {
                //init prefab
                PlayableCharacter instance = (PlayableCharacter)Instantiate(PlayablePlayers[i]);
                //position based of starting position object point
                instance.transform.position = new Vector2(startingPosition.transform.position.x + i * DistanceBetweenPlayers, startingPosition.transform.position.y);
                //manually set initial position
                instance.SetInitialPosition(instance.transform.position);
                //send it to the game manager
                CurrentPlayablePlayers.Add(instance);
            }
            EventManager.StartEvent("PlayablePlayersInstantiated");
        }
Example #3
0
        /// <summary>
        /// Triggers the collision.
        /// </summary>
        /// <param name="collidingGameObject">Colliding game object.</param>
        protected virtual void TriggerCollision(GameObject collidingGameObject)
        {
            //if colliding object does not have the player tag, do nothing
            if (collidingGameObject.tag != "Player")
            {
                return;
            }

            PlayableCharacter player = collidingGameObject.GetComponent <PlayableCharacter> ();

            if (player == null)
            {
                return;
            }

            //tell the level manager to kill the player
            LevelManager.Instance.KillPlayer(player);
        }
		/// <summary>
		/// coroutine that Kills the player, stops the camera and resets the game points
		/// </summary>
		/// <returns>The player I.</returns>
		/// <param name="player">Player.</param>
		protected virtual IEnumerator killPlayerIE (PlayableCharacter player)
		{
			LevelManager.Instance.CurrentPlayablePlayers.Remove (player);
			player.Die ();

			yield return new WaitForSeconds (0.0f);

			//if last player trigger all players are dead coroutine
			if (LevelManager.Instance.CurrentPlayablePlayers.Count == 0) {
				AllPlayersDead ();
			}
		}
		/// <summary>
		/// Kills the player.
		/// </summary>
		/// <param name="player">Player.</param>
		public virtual void KillPlayer (PlayableCharacter player)
		{
			StartCoroutine (killPlayerIE (player));
		}
Example #6
0
 /// <summary>
 /// Kills the player.
 /// </summary>
 /// <param name="player">Player.</param>
 public virtual void KillPlayer(PlayableCharacter player)
 {
     StartCoroutine(killPlayerIE(player));
 }