setting up enemy consumption and increasing score - maybe change?

This commit is contained in:
Amaan Shawkath
2022-04-19 21:43:27 +01:00
parent 209470d610
commit e2511e2d53
7 changed files with 6779 additions and 10 deletions

View File

@@ -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();
}
}