Exemple #1
0
    private void OnMouseEnter()
    {
        playsceneUI uicontrol = GameObject.Find("Canvas").GetComponent <playsceneUI>();

        if (uicontrol.Hovertower != null && uicontrol.Currenttower != null && havetower == false)
        {
            if (uicontrol.Hovertower.tag == "tower")
            {
                hovertower = Instantiate(uicontrol.Hovertower);
                hovertower.transform.position = towerposition.position;
                hovertower.GetComponent <BoxCollider>().enabled = false;
                hovertower.GetComponent <tower>().selectcircle.SetActive(true);
                hovertower.GetComponent <tower>().enabled = false;
            }
        }
    }
Exemple #2
0
 // Update is called once per frame
 void Update()
 {
     if (stage.getphase() == 1 && phase == 0)
     {
         phase = 1;
     }
     if (phase == 1)
     {
         if (stage.getbase() == 0)
         {
             normalhiglight(select);
             phase = 2;
         }
     }
     else if (phase == 2)
     {
         if (stage.getmoney() == 0)
         {
             normalhiglight(select);
             phase = 3;
         }
     }
     else if (phase == 3)
     {
         if (stage.getphase() == 2)
         {
             normalhiglight(select);
             phase = 4;
         }
     }
     else if (phase == 4)
     {
         if (stage.getphase() == 3)
         {
             if (phase5resource == false)
             {
                 phase5resource = true;
                 stage.increasemoney(250);
             }
             phase = 5;
         }
     }
     else if (phase == 5)
     {
         if (stage.getphase() == 2)
         {
             phase = 6;
         }
     }
     else if (phase == 6)
     {
         if (stage.getphase() == 3)
         {
             if (phase7resource == false)
             {
                 phase7resource = true;
                 phase7missile  = 0;
                 stage.increasemoney(200);
                 GameObject[] alltower = GameObject.FindGameObjectsWithTag("tower");
                 foreach (var item in alltower)
                 {
                     if (item.name == "Missile(Clone)")
                     {
                         phase7missile++;
                     }
                 }
             }
             phase = 7;
         }
     }
     else if (phase == 7)
     {
         int          allmissile = 0;
         GameObject[] alltower   = GameObject.FindGameObjectsWithTag("tower");
         foreach (var item in alltower)
         {
             if (item.name == "Missile(Clone)")
             {
                 allmissile++;
             }
         }
         if (allmissile - phase7missile == 2)
         {
             normalhiglight(select);
             phase = 8;
         }
     }
     else if (phase == 8)
     {
         if (stage.getphase() == 2)
         {
             normalhiglight(select);
             phase = 9;
         }
     }
     else if (phase == 9)
     {
         if (stage.getphase() == 3)
         {
             phase = 10;
         }
     }
     else if (phase == 10)
     {
         GameObject[] towerbutton = GameObject.FindGameObjectsWithTag("button");
         GameObject[] alltower    = GameObject.FindGameObjectsWithTag("tower");
         phase10tower = alltower.Length;
         foreach (var item in towerbutton)
         {
             if (item.name == "tower button" && item.active)
             {
                 select = item.GetComponent <Button>();
                 phase  = 11;
             }
         }
     }
     else if (phase == 11)
     {
         GameObject[] alltower = GameObject.FindGameObjectsWithTag("tower");
         if (phase10tower > alltower.Length)
         {
             select       = null;
             Highlightime = 1;
             phase        = 12;
         }
     }
     else if (phase == 12)
     {
         if (custompanel.active)
         {
             normalhiglight(select);
             phase = 13;
         }
     }
     else if (phase == 13)
     {
         GameObject coreclone = GameObject.Find("core2_1(Clone)");
         if (coreclone != null)
         {
             normalhiglight(select);
             GameObject weaponbutton = GameObject.Find("Button weapon");
             select = weaponbutton.GetComponent <Button>();
             higlight(select);
             phase = 14;
         }
     }
     else if (phase == 14)
     {
         if (weaponpanel.active)
         {
             normalhiglight(select);
             phase = 15;
         }
     }
     else if (phase == 15)
     {
         GameObject alpha       = GameObject.Find("tower alpha");
         int        weaponcount = 0;
         foreach (GameObject item in alpha.GetComponent <tower>().Towerweapon)
         {
             if (item != null)
             {
                 weaponcount++;
             }
         }
         if (weaponcount == alpha.GetComponent <tower>().Towerweapon.Length)
         {
             GameObject build = GameObject.Find("build");
             select = build.GetComponent <Button>();
             higlight(select);
             phase = 16;
         }
     }
     else if (phase == 16)
     {
         if (custompanel.active == false)
         {
             normalhiglight(select);
             phase = 17;
             if (phase17resource == false)
             {
                 phase17resource = true;
                 stage.increasemoney(300);
             }
         }
     }
     else if (phase == 17)
     {
         playsceneUI ui = GameObject.Find("Canvas").GetComponent <playsceneUI>();
         if (ui.Currenttower != null)
         {
             if (ui.Currenttower.name == "tower alpha")
             {
                 normalhiglight(select);
                 phase = 18;
             }
         }
     }
     else if (phase == 18)
     {
         GameObject custom = GameObject.Find("tower alpha(Clone)");
         if (custom != null)
         {
             phase = 19;
         }
     }
     else if (phase == 19)
     {
         if (stage.getphase() == 2)
         {
             phase = 20;
         }
     }
 }