예제 #1
0
 public void ChampSelect()
 {
     if (Input.GetMouseButtonDown(0))
     {
         Debug.Log(champTarget);
         //Select champion when nothing is selected
         if (ClickSelect() != null)
         {
             if (ClickSelect().tag == "Champion" && champTarget == null)
             {
                 champTarget          = ClickSelect().GetComponent <ChampionController>().champion;
                 champTarget.Selected = true;
             }
             else if (champTarget != null && ClickSelect().tag == "Enemy")
             {
                 TargetEnemy = ClickSelect().GetComponent <EnemyDisplay>().enemy;
                 champTarget.Attack(TargetEnemy);
                 champTarget.Selected = false;
                 champTarget          = null;
             }
             else if (champTarget == null && ClickSelect().tag == "Enemy")
             {
                 TargetEnemy          = ClickSelect().GetComponent <EnemyDisplay>().enemy;
                 TargetEnemy.Selected = true;
             }
         }
         else if (ClickSelect() == null)
         {
             if (champTarget != null)
             {
                 champTarget.Selected = false;
                 champTarget          = null;
             }
             else if (TargetEnemy != null)
             {
                 TargetEnemy.Selected = false;
                 TargetEnemy          = null;
             }
         }
     }
 }