Beispiel #1
0
        public void OnTriggerEnter2D(Collider2D collision)
        {
            Player   player   = collision.GetComponent <Player>();
            Coworker coworker = collision.GetComponent <Coworker>();

            if (collision.gameObject.tag == "Player")
            {
                if (!GetPlayerHasPaper())
                {
                    Debug.Log("PAPER GRABBED BY PLAYER ");
                    SoundManager.instance.RandomizeSfx(handlePaper1, handlePaper2, handlePaper3);
                    Destroy(gameObject);
                    if (gameObject != null)
                    {
                        Destroy(gameObject);
                        SetPlayerHasPaper(true);
                    }
                }
            }

            if (collision.gameObject.tag == "Coworker")
            {
                if (!GetCoworkerHasPaper())
                {
                    Debug.Log("PAPER GRABBED BY COWORKER ");
                    SoundManager.instance.RandomizeSfx(handlePaper1, handlePaper2, handlePaper3);
                    if (gameObject != null)
                    {
                        Destroy(gameObject);
                        SetCoworkerHasPaper(true);
                    }
                }
            }
        }
Beispiel #2
0
 void Awake()
 {
     instance = this;
 }