예제 #1
0
    void OnMouseDown()
    {
        if (alive == false)
        {
            return;
        }
        else
        {
            if (awake == false)
            {
                menu_holder.GetComponent <CanvasGroup>().alpha = 1f;
                awake = true;
                StatSelector.SetName(gameObject.tag);
                if (gameObject.tag == "GoldMine")
                {
                    StatSelector.SetGold(2);
                    StatSelector.SetSprite(sprite);
                    StatSelector.SetPrice(g.build_cost / 2);
                }
                else if (gameObject.tag == "missileresearch")
                {
                    StatSelector.SetNumber(ReturnMissileLength() * 5);
                    StatSelector.SetSprite(sprite);
                    StatSelector.SetPrice(g.research_cost / 2);
                }
                else if (gameObject.tag == "lightresearch")
                {
                    StatSelector.SetNumber(ReturnLightLength() * 5);
                    StatSelector.SetSprite(sprite);
                    StatSelector.SetPrice(g.research_cost / 2);
                }
                else if (gameObject.tag == "slowresearch")
                {
                    StatSelector.SetNumber(ReturnLaserLength() * 2);
                    StatSelector.SetSprite(sprite);
                    StatSelector.SetPrice(g.research_cost / 2);
                }
                else if (gameObject.tag == "Explorer")
                {
                    StatSelector.ExploreInfo();
                    StatSelector.SetSprite(sprite);
                }
                else
                {
                    StatSelector.SetDamage(returnDPS());
                    StatSelector.SetPrice(g.turr_cost / 2);
                }


                print("hello");
            }
            else
            {
                menu_holder.GetComponent <CanvasGroup>().alpha = 0f;
                awake = false;
            }
        }
    }
예제 #2
0
 public float returnDPS()
 {
     StatSelector.SetSprite(sprite);
     if (gameObject.tag == "LightGun")
     {
         return(gameObject.GetComponent <Turret>().returnDamage());
     }
     else if (gameObject.tag == "Laser")
     {
         return(gameObject.GetComponent <Turret>().damageOT);
     }
     else if (gameObject.tag == "Missile")
     {
         return(gameObject.GetComponent <Turret>().returnDamage());
     }
     return(0);
 }