Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        randCoin = Random.Range(-15, 30);
        pos      = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        hit      = Physics2D.Raycast(pos, Vector2.zero, 0f);
        if (hit.collider != null)
        {
            if (hit.collider.gameObject == lottobtn)
            {
                if (Input.GetMouseButtonDown(0))
                {
                    sr.sprite = btn[0];
                }

                if (Input.GetMouseButtonUp(0))
                {
                    sr.sprite = btn[1];
                    if (staticV.coin >= 10)
                    {
                        um.coinUp(-10);
                        um.coinUp(randCoin);
                    }
                }
            }
        }
        else
        {
            sr.sprite = btn[1];
        }
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        pos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        hit = Physics2D.Raycast(pos, Vector2.zero, 0f);
        if (hit.collider != null)
        {
            if (hit.collider.gameObject == bulletbtn)
            {
                if (Input.GetMouseButtonDown(0))
                {
                    sr.sprite = btn[0];
                }

                if (Input.GetMouseButtonUp(0))
                {
                    sr.sprite = btn[1];
                    if (staticV.bulletCount < 3)
                    {
                        if (staticV.bulletCount == 0)
                        {
                            if (staticV.coin >= staticV.bulletCoin)
                            {
                                um.coinUp(-staticV.bulletCoin);
                                staticV.bulletCoin = 75;
                                bm.bulletUp();
                                staticV.bulletCount += 1;
                            }
                        }
                        if (staticV.bulletCount == 1)
                        {
                            if (staticV.coin >= staticV.bulletCoin)
                            {
                                um.coinUp(-staticV.bulletCoin);
                                staticV.bulletCoin = 100;
                                bm.bulletUp();
                                staticV.bulletCount += 1;
                            }
                        }
                        if (staticV.bulletCount == 2)
                        {
                            if (staticV.coin >= staticV.bulletCoin)
                            {
                                um.coinUp(-staticV.bulletCoin);
                                staticV.bulletCoin = 125;
                                bm.bulletUp();
                                staticV.bulletCount += 1;
                            }
                        }
                    }
                }
            }
        }
        else
        {
            sr.sprite = btn[1];
        }
    }
Beispiel #3
0
    // Update is called once per frame
    void Update()
    {
        pos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        hit = Physics2D.Raycast(pos, Vector2.zero, 0f);
        if (hit.collider != null)
        {
            if (hit.collider.gameObject == pet1btn)
            {
                if (Input.GetMouseButtonDown(0))
                {
                    sr.sprite = btn[0];
                }

                if (Input.GetMouseButtonUp(0))
                {
                    sr.sprite = btn[1];
                    if (staticV.coin >= 60)
                    {
                        um.coinUp(-60);
                        staticV.pet1 = true;
                    }
                }
            }
        }
        else
        {
            sr.sprite = btn[1];
        }
    }
Beispiel #4
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.tag == "Player")
     {
         um.coinUp(1);
         coinCheck = true;
     }
 }