added boss (final commit)
This commit is contained in:
1 parent
ff19b0461e
commit
0a1cecfb4a
71 files changed
+1953
-144
No files matched your search
@@ -0,0 +1,23 @@
|
||||
using Code.Gameplay.Player;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Gameplay
|
||||
{
|
||||
public class BossTrigger: MonoBehaviour
|
||||
{
|
||||
private bool _triggered;
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (!other.CompareTag("Player") || _triggered) return;
|
||||
|
||||
Instantiate(Resources.Load<GameObject>("Prefabs/Boss"));
|
||||
_triggered = true;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_triggered && FindFirstObjectByType<PlayerMovement>().gameObject.transform.position.x > transform.position.x + 10)
|
||||
GetComponent<Collider2D>().isTrigger = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user