Beispiel #1
0
    protected override void OnCollisionEnter2D(Collision2D collision)
    {
        base.OnCollisionEnter2D(collision);
        GameObject obj = collision.gameObject;

        if (obj.CompareTag("Player"))
        {
            playerChaser.StopAllChases();
            return;
        }

        // Edge of the sceen or Green Web
        if (collision.enabled && gameObject.activeSelf == true)
        {
            if (movementRoutine != null)
            {
                StopCoroutine(movementRoutine);
                playerChaser.StopAllChases();
            }

            if (bounce.BounceAmount == 0)
            {
                StartCoroutine(bounce.ResetRoutine());
                bounce.ResetBounces(3);
                playerChaser.SetPlayerTarget();
                playerChaser.CheckNextTarget();
                return;
            }

            StartCoroutine(bounce.BounceRoutine());
            bounce.DecreaseBounce();
        }
    }
Beispiel #2
0
    protected override void OnCollisionEnter2D(Collision2D collision)
    {
        base.OnCollisionEnter2D(collision);
        GameObject obj = collision.gameObject;

        // Edge of the sceen or Green Web
        if (collision.enabled && gameObject.activeSelf == true)
        {
            if (movementRoutine != null)
            {
                StopCoroutine(movementRoutine);
            }

            if (bounce.BounceAmount == 0)
            {
                StartCoroutine(bounce.ResetRoutine());
                bounce.ResetBounces(8);
                movementRoutine = StartCoroutine(StartMovementRoutine());
                return;
            }

            StartCoroutine(bounce.BounceRoutine());
            bounce.DecreaseBounce();
        }
    }
Beispiel #3
0
    protected override void Awake()
    {
        base.Awake();
        playerChaser = GetComponent <PlayerChaser>();
        bounce       = GetComponent <BounceComponent>();
        bounce.ResetBounces(3);
        spawn = GetComponent <SpawnComponent>();

        EventList.grubCollect += Beetle_OnBugCollect;
    }