Enemies half done

This commit is contained in:
Gerard Gascón 2023-08-22 20:12:53 +02:00
parent eaa8cdd462
commit 16507f4121
93 changed files with 31744 additions and 119 deletions

View file

@ -0,0 +1,26 @@
using DG.Tweening;
using UnityEngine;
namespace Level11 {
public class EnemyWeakPoint11 : MonoBehaviour {
Enemy11 _enemy;
void Awake() {
_enemy = GetComponentInParent<Enemy11>();
}
void OnTriggerEnter2D(Collider2D other) {
if (!other.CompareTag("Player") && !other.CompareTag("Bullet")) return;
PlayerMovement11 player = other.GetComponent<PlayerMovement11>();
if(player) player.Rb.velocity = new Vector2(player.Rb.velocity.x, player.deathForce);
if(player) player.Animator.SetTrigger(PlayerMovement11.Jump1);
if(player) player.BounceAnimator.SetTrigger(PlayerMovement11.Bounce);
if(!player) Destroy(other.gameObject);
Destroy(_enemy.gameObject);
}
}
}