Ejemplo n.º 1
0
    void Awake()
    {
        // Setting up the references.
        anim            = GetComponent <Animator>();
        enemyAudio      = GetComponent <AudioSource>();
        capsuleCollider = GetComponent <CapsuleCollider>();
        enemyAnim       = GetComponent <EnemyAnimation> ();
        enemyFollow     = GetComponent <EnemyFollowPlayer> ();

        // Setting the current health when the enemy first spawns.
        currentHealth = startingHealth;
    }
Ejemplo n.º 2
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        SteakMove         steak  = collision.collider.GetComponent <SteakMove>();
        EnemyFollowPlayer steak2 = collision.gameObject.GetComponent <EnemyFollowPlayer>();

        if (steak != null || steak2 != null)
        {
            Hurt();
        }

        if (collision.gameObject.tag == "Ground")
        {
            isJumping = false;
        }
    }
    private void OnCollisionEnter2D(Collision2D collision)
    {
        SteakMove         steak    = collision.collider.GetComponent <SteakMove>();
        EnemyFollowPlayer pumpkin  = collision.gameObject.GetComponent <EnemyFollowPlayer>();
        MushroomBehavior  mushroom = collision.gameObject.GetComponent <MushroomBehavior>();

        if (steak != null || pumpkin != null || mushroom != null)
        {
            Hurt();
        }

        if (collision.gameObject.tag == "Ground")
        {
            isJumping = false;
        }
    }