Esempio n. 1
0
            private void OnTriggerStay2D(Collider2D other)
            {
                if (canShoot)
                {
                    NormalCrabBehaviour ncb = other.GetComponent <NormalCrabBehaviour>();
                    CrabParrotBehavior  cpb = other.GetComponent <CrabParrotBehavior>();

                    if (ncb != null)
                    {
                        ncb.isShot = true;
                        FindObjectOfType <AudioManager>().Play("Coup de Golf");
                    }
                    else if (cpb != null)
                    {
                        cpb.isShot = true;
                        FindObjectOfType <AudioManager>().Play("Frappe Perroquet");
                        canShoot = false;
                        StartCoroutine(Lose());
                    }
                    IEnumerator Lose()
                    {
                        yield return(new WaitForSeconds(1));

                        animator.SetBool("Lose", true);
                        FindObjectOfType <AudioManager>().Play("Défaite");
                    }
                }
            }
Esempio n. 2
0
            private void OnTriggerEnter2D(Collider2D collision)
            {
                NormalCrabBehaviour ncb = collision.GetComponent <NormalCrabBehaviour>();
                CrabParrotBehavior  cpb = collision.GetComponent <CrabParrotBehavior>();

                if (cpb != null)
                {
                    markDontShot.enabled = true;
                }
                else if (ncb != null)
                {
                    markShot.enabled = true;
                }
            }
            private void OnTriggerStay2D(Collider2D other)
            {
                if (canShoot)
                {
                    NormalCrabBehaviour ncb = other.GetComponent <NormalCrabBehaviour>();
                    CrabParrotBehavior  cpb = other.GetComponent <CrabParrotBehavior>();

                    if (ncb != null)
                    {
                        ncb.isShot = true;
                    }
                    else if (cpb != null)
                    {
                        cpb.isShot = true;
                        canShoot   = false;
                        animator.SetBool("Lose", true);
                    }
                }
            }