setting up enemy consumption and increasing score - maybe change?
This commit is contained in:
@@ -7,6 +7,10 @@ public class Enemy : MonoBehaviour
|
||||
public int baseScore;
|
||||
public PatternTypes[] patterns;
|
||||
public int CurrentPattern = 0;
|
||||
public float scoreMultiplier = 0;
|
||||
|
||||
public bool IsDead { get; private set; }
|
||||
|
||||
private BulletManager bulletManager;
|
||||
|
||||
// Start is called before the first frame update
|
||||
@@ -24,23 +28,39 @@ public class Enemy : MonoBehaviour
|
||||
|
||||
private void Attack()
|
||||
{
|
||||
bulletManager.SpawnPattern(patterns[CurrentPattern], this);
|
||||
bulletManager.SpawnPattern(patterns[CurrentPattern], this);
|
||||
}
|
||||
|
||||
public void Consumed()
|
||||
{
|
||||
gameObject.SetActive(false); // TODO: some sort of effect
|
||||
|
||||
// once the enemy dies it should stop emitting bullets but keep any active bullets running
|
||||
IsDead = true;
|
||||
|
||||
bulletManager.EnemyConsumed(scoreMultiplier);
|
||||
}
|
||||
|
||||
|
||||
public void OnPatternFinished()
|
||||
{
|
||||
CurrentPattern++;
|
||||
if (CurrentPattern >= patterns.Length)
|
||||
if (gameObject.activeSelf)
|
||||
{
|
||||
//Destroy(gameObject);
|
||||
CurrentPattern++;
|
||||
if (CurrentPattern >= patterns.Length)
|
||||
{
|
||||
//Destroy(gameObject);
|
||||
}
|
||||
Attack();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.gameObject.GetComponent<Player>())
|
||||
{
|
||||
// okay.. player hit so we're being consumed
|
||||
Consumed();
|
||||
}
|
||||
Attack();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user