Finished
This commit is contained in:
parent
16507f4121
commit
436dd245aa
84 changed files with 79361 additions and 75 deletions
27
Assets/Scripts/Level 18/EnemyWeakPoint18.cs
Normal file
27
Assets/Scripts/Level 18/EnemyWeakPoint18.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Level18 {
|
||||
public class EnemyWeakPoint18 : MonoBehaviour {
|
||||
|
||||
Enemy18 _enemy;
|
||||
|
||||
void Awake() {
|
||||
_enemy = GetComponentInParent<Enemy18>();
|
||||
}
|
||||
|
||||
void OnTriggerEnter2D(Collider2D other) {
|
||||
if (!other.CompareTag("Player") && !other.CompareTag("Bullet")) return;
|
||||
PlayerMovement18 player = other.GetComponent<PlayerMovement18>();
|
||||
|
||||
if(player) player.Rb.velocity = new Vector2(player.Rb.velocity.x, player.deathForce);
|
||||
if(player) player.Animator.SetTrigger(PlayerMovement18.Jump1);
|
||||
if(player) player.BounceAnimator.SetTrigger(PlayerMovement18.Bounce);
|
||||
|
||||
if(!player) Destroy(other.gameObject);
|
||||
|
||||
_enemy.DoKill();
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue