// Attack player void OnTriggerEnter2D(Collider2D collision) { if ((collision.tag == "Player") && !isStunned) { KinectManager player = collision.gameObject.GetComponent <KinectManager>(); if (player.playerCanMove) { // Make sure the enemy is facing the player on attack Flip(collision.transform.position.x - _transform.position.x); // attack sound playSound(attackSFX); // stop moving _rigidbody.velocity = new Vector2(0, 0); // apply damage to the player player.ApplyDamage(damageAmount); // stop to enjoy killing the player _moveTime = Time.time + stunnedTime; } } }