Esempio n. 1
0
    public void ReactTo_HeroCollision()
    {
        if (isFlawed)
        {
            // Change animation
            animator.SetBool("isReturning", true);

            // Change tag
            gameObject.tag = "Projectile Returning";

            // Return (change direction and speed)
            myRigidbody.velocity = new Vector2(myRigidbody.velocity.x * (-1) * projectileSpeedModifier,
                                               myRigidbody.velocity.y);

            // Set as returning
            isReturning = true;

            // Fire event: Flawed projectile collided with hero
            FlawedProjectile_CollidedWithHero?.Invoke();
        }

        else
        {
            // Change animation
            animator.SetBool("isDead", true);

            // Reduce speed
            myRigidbody.velocity = Vector2.left * maxSpeed / 1.5f;
        }
    }
Esempio n. 2
0
 private void RespondTo_FlawedProjectile_CollidedWithHero_Event()
 {
     FlawedProjectile_CollidedWithHero?.Invoke();
 }