Exemplo n.º 1
0
 private void Click()
 {
     if (!isActionUIOpen && !isAttackUIOpen)
     {
         if (!SelectedLifie)
         {
             SelectLifie();
             if (SelectedLifie)
             {
                 SelectedLifie.FindSelectableTiles(0);
                 int i = 0;
                 foreach (Transform child in GameObject.Find("AttackButtons").transform)
                 {
                     child.Find("Canvas").transform.Find("Text").GetComponent <Text>().text = GameObject.Find("AttackDatabase").GetComponent <AttackDatabase>().GetAttack(SelectedLifie.GetAttack(i)).Name;
                     i++;
                 }
             }
         }
         else if (SelectingTarget)
         {
             if (HoveringLifie && HoveringLifie != SelectedLifie)
             {
                 if (SelectedLifie.Attack(HoveringLifie, SelectedAttack))
                 {
                     SelectedLifie.Disable();
                     Reset();
                 }
             }
         }
         else
         {
             if (SelectedLifie.MoveTo(HoveringTile))
             {
                 //SelectedLifie = null;
                 GameObject.Find("MetaObject").GetComponent <MetaObject>().ResetTiles();
                 ShowActionUI();
             }
         }
     }
     else
     {
         if (isActionUIOpen)
         {
             RaycastHit[] hits;
             hits = Physics.RaycastAll(GameObject.Find("ActionCursor").transform.position, new Vector3(0, -1, 0));
             foreach (RaycastHit hit in hits)
             {
                 if (hit.collider.gameObject.name == "AttackButton")
                 {
                     GameObject.Find("LogBox").GetComponent <LogBox>().SetLogBoxText("Which attack do you choose?");
                     AttackAction();
                     break;
                 }
                 if (hit.collider.gameObject.name == "WaitButton")
                 {
                     GameObject.Find("LogBox").GetComponent <LogBox>().SetLogBoxText(SelectedLifie.Name + " is waiting.");
                     WaitAction();
                     break;
                 }
                 if (hit.collider.gameObject.name == "CancelButton")
                 {
                     CancelAction();
                     break;
                 }
             }
         }
         else if (isAttackUIOpen)
         {
             SelectedAttack = HoveringAttack;
             GameObject.Find("LogBox").GetComponent <LogBox>().SetLogBoxText("Selected attack: " + SelectedAttack.Name + ".");
             HideAttackUI();
             SelectedLifie.FindSelectableAttack(SelectedAttack.RangeCapacity, SelectedAttack.isStatusAttack());
             SelectingTarget = true;
         }
     }
 }