Esempio n. 1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (IsNotFlicker)
        {
            #region PeopleCollision
            if (collision.CompareTag("People"))
            {
                AddScore();
                PlayPeopleEatSound();

                OnPeopleEat?.Invoke();

                if (collision.name != "D_People")
                {
                    StartCoroutine(Twiner.UnsizeAndReposition(Spawner.NewPeoplePosition(), collision.gameObject));
                }

                if (collision.name == "D_People")
                {
                    StartCoroutine(Twiner.UnsizeAndDestroy(collision.gameObject));
                }
            }
            #endregion

            #region VirusCollision
            if (collision.GetComponent <Tail>() != null && collision.name != gameObject.name)
            {
                if (collision.GetComponent <Tail>().head.IsNotFlicker)
                {
                    PlayerCamera.Singletone.SetMoveTarget(collision.gameObject);
                    PlayDeathSound();
                    Death();
                }
            }

            if (collision.GetComponent <VirusHead>() != null && collision.name != gameObject.name)
            {
                VirusHead head = collision.GetComponent <VirusHead>();

                if (head.IsNotFlicker)
                {
                    if (head.Wide >= Wide)
                    {
                        PlayerCamera.Singletone.SetMoveTarget(collision.gameObject);
                        PlayDeathSound();
                        Death();
                    }
                }
            }
            #endregion
        }

        if (collision.name == "PlayArea")
        {
            Stun(collision);
        }
    }
Esempio n. 2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.CompareTag("People") && collision.name != "D_People")
        {
            _numOfPeopleUnderSplash++;
            StartCoroutine(Twiner.UnsizeAndReposition(Spawner.NewPeoplePosition(), collision.gameObject));
        }

        if (collision.CompareTag("People") && collision.name == "D_People")
        {
            _numOfPeopleUnderSplash++;
            StartCoroutine(Twiner.UnsizeAndDestroy(collision.gameObject));
        }
    }