예제 #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        /*
         #if UNITY_EDITOR
         * if (Input.GetKey(KeyCode.C))
         * {
         *  GameDataManager.AddCoins(179);
         * }
         #endif
         */

        if (collision.gameObject.CompareTag("Coin"))
        {
            AudioController.instance.PlaySound(takeCoinSfx);

            GameDataManager.AddCoins(10);

            GameSharedUI.Instance.UpdateCoinsUIText();

            Destroy(collision.gameObject);
        }
    }
예제 #2
0
    void OnCollisionEnter2D(Collision2D other)
    {
        string tag = other.collider.tag;

        if (tag.Equals("coin"))
        {
            //Add Coins
            GameDataManager.AddCoins(32);

            // Cheating (while moving hold key "C" to get extra coins)
         #if UNITY_EDITOR
            if (Input.GetKey(KeyCode.C))
            {
                GameDataManager.AddCoins(179);
            }
         #endif

            GameSharedUI.Instance.UpdateCoinsUIText();

            Destroy(other.gameObject);
        }
    }
예제 #3
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == "bullet")
        {
            Auds.PlayOneShot(audClip);

            Debug.Log("working");
            GameDataManager.AddCoins(1);

            // Cheating (while moving hold key "C" to get extra coins)
                        #if UNITY_EDITOR
            if (Input.GetKey(KeyCode.C))
            {
                GameDataManager.AddCoins(179);
            }
                        #endif

            GameSharedUI.Instance.UpdateCoinsUIText();
            Destroy(gameObject);
        }



        if (col.tag == "bullet1")
        {
            Debug.Log("dd");
            Auds.PlayOneShot(audClip);
            Destroy(gameObject);
            GameDataMF.AddCoins(1);
            // Cheating (while moving hold key "C" to get extra coins)
            #if UNITY_EDITOR
            if (Input.GetKey(KeyCode.C))
            {
                GameDataMF.AddCoins(179);
            }
            #endif
            GameSUIF.Instance.UpdateCoinsUIText();
        }


        if (col.tag == "bullet2")
        {
            Debug.Log("dd");
            Auds.PlayOneShot(audClip);
            Destroy(gameObject);
            GameDataMH.AddCoins(1);
            // Cheating (while moving hold key "C" to get extra coins)
            #if UNITY_EDITOR
            if (Input.GetKey(KeyCode.C))
            {
                GameDataMH.AddCoins(179);
            }
            #endif
            GameSUIH.Instance.UpdateCoinsUIText();
        }

        if (col.tag == "bullet3")
        {
            Debug.Log("dd");
            Auds.PlayOneShot(audClip);
            Destroy(gameObject);
        }
    }