Example #1
0
 // Update is called once per frame
 void Update()
 {
     if (isTargeting)
     {
         if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow))
         {
             if (target == 0)
             {
                 target = Constants.MAX_ENEMIES - 1;
             }
             else if (target != Constants.MAX_ENEMIES)
             {
                 target -= 1;
             }
             UpdateTarget(-1);
         }
         else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow))
         {
             if (target == Constants.MAX_ENEMIES - 1)
             {
                 target = 0;
             }
             else if (target != Constants.MAX_ENEMIES)
             {
                 target += 1;
             }
             UpdateTarget(1);
         }
         if (gameManager.AnalysisEnabled)
         {
             Monster monst = GetFirstTarget();
             if (monst == null)
             {
                 return;
             }
             gameManager.DisplayAnalysis(monst.Stats, GetMonsterByName(monst.Stats.Name));
         }
         if (IsCasting)
         {
             if (GetFirstTarget() != null)
             {
                 if (Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown(KeyCode.Return) || Input.GetMouseButton((int)MouseButton.LeftMouse))
                 {
                     IsCasting = false;
                     StartCoroutine(CastSkill(currentSkill, player));
                     ChangeTargeting(false);
                 }
             }
         }
     }
     if (Input.GetKeyDown(KeyCode.O))
     {
         InitTurns();
     }
     if (Input.GetKeyDown(KeyCode.P))
     {
         AdvanceTurn();
     }
     hpText.text = "HP: " + player.CurrentHealth + "/" + player.Stats.MaxHealth;
     mpText.text = "MP: " + player.CurrentMana + "/" + player.Stats.MaxMana;
 }