コード例 #1
0
 /// <summary>
 /// This function is fiered when the PlayerKilled is invoked
 /// Ends the level
 /// </summary>
 /// <param name="_">the object calling</param>
 /// <param name="args">the event args</param>
 private void CallbackPlayerLivesUpdate(object _, PlayerLivesUpdateArgs args)
 {
     if (args.CurrentLives == 0)
     {
         LevelStateChange(LEVEL_STATE.GAME_OVER);
     }
 }
コード例 #2
0
 private void CallbackOnLivesUpdate(object _, PlayerLivesUpdateArgs args)
 {
     if (!initialized)
     {
         GenerateLifeObject(args.CurrentLives);
         initialized = true;
     }
     else
     {
         var heartsLeft = this.lifesObjects.FindAll(life => life.gameObject.activeSelf).Count;
         if (heartsLeft < args.CurrentLives)
         {
             this.AddLife(args.CurrentLives - heartsLeft);
         }
         else if (heartsLeft > args.CurrentLives)
         {
             this.RemoveLife(heartsLeft - args.CurrentLives);
         }
     }
 }