Final gamerjam state #1

Merged
JanGross merged 18 commits from dev into master 2022-04-30 14:38:07 +02:00
7 changed files with 6779 additions and 10 deletions
Showing only changes of commit e2511e2d53 - Show all commits

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c3c99fe455db51e41bed31b035a387f5
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -21,10 +21,12 @@ public class BulletManager : MonoBehaviour
public List<PatternMap> PatternMap = new List<PatternMap>(); public List<PatternMap> PatternMap = new List<PatternMap>();
public Pattern[] activePatterns; public Pattern[] activePatterns;
private GameManager gameManager;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
gameManager = FindObjectOfType<GameManager>();
} }
// Update is called once per frame // Update is called once per frame
@@ -33,6 +35,11 @@ public class BulletManager : MonoBehaviour
} }
public void EnemyConsumed(float multiplier)
{
gameManager.EnemyConsumed(multiplier);
}
public void SpawnPattern(PatternTypes pattern, Enemy enemy) public void SpawnPattern(PatternTypes pattern, Enemy enemy)
{ {
GameObject patternObject = Instantiate(PatternMap.Find(x => x.patternType == pattern).pattern, enemy.transform.position, Quaternion.identity); GameObject patternObject = Instantiate(PatternMap.Find(x => x.patternType == pattern).pattern, enemy.transform.position, Quaternion.identity);

View File

@@ -31,9 +31,13 @@ public class GameManager : MonoBehaviour
} }
public void EnemyConsumed() public void EnemyConsumed(float multiplier = 0)
{ {
enemiesConsumed++;
float incMutliplier = (multiplier > 0) ? multiplier : scoreMultiplier;
score += Mathf.FloorToInt(50 * incMutliplier); // TODO: how do we want this to work exactly?
} }
public void PlayerDed() public void PlayerDed()

View File

@@ -20,7 +20,7 @@ public class Pattern : MonoBehaviour
{ {
OnPatternUpdate(); OnPatternUpdate();
duration -= Time.deltaTime; duration -= Time.deltaTime;
if (duration <= 0) if (duration <= 0 || enemy.IsDead)
{ {
//find all particle systems in children and stop them //find all particle systems in children and stop them
foreach (ParticleSystem ps in GetComponentsInChildren<ParticleSystem>()) foreach (ParticleSystem ps in GetComponentsInChildren<ParticleSystem>())

View File

@@ -8,6 +8,8 @@ public class UIManager : MonoBehaviour
{ {
public TextMeshProUGUI playerHealthLabel; public TextMeshProUGUI playerHealthLabel;
public TextMeshProUGUI gameOverLabel; public TextMeshProUGUI gameOverLabel;
public TextMeshProUGUI scoreLabel;
public Button restartButton; public Button restartButton;
private GameManager gameManager; private GameManager gameManager;
@@ -23,11 +25,12 @@ public class UIManager : MonoBehaviour
//round player health //round player health
playerHealthLabel.text = "Health: " + Mathf.Round(gameManager.player.health).ToString(); playerHealthLabel.text = "Health: " + Mathf.Round(gameManager.player.health).ToString();
scoreLabel.text = "Score: " + Mathf.Round(gameManager.score).ToString();
if (gameManager.player.health <= 0) if (gameManager.player.health <= 0)
{ {
gameOverLabel.gameObject.SetActive(true); gameOverLabel.gameObject.SetActive(true);
restartButton.gameObject.SetActive(true); restartButton.gameObject.SetActive(true);
} }
} }
} }

View File

@@ -7,6 +7,10 @@ public class Enemy : MonoBehaviour
public int baseScore; public int baseScore;
public PatternTypes[] patterns; public PatternTypes[] patterns;
public int CurrentPattern = 0; public int CurrentPattern = 0;
public float scoreMultiplier = 0;
public bool IsDead { get; private set; }
private BulletManager bulletManager; private BulletManager bulletManager;
// Start is called before the first frame update // Start is called before the first frame update
@@ -29,11 +33,17 @@ public class Enemy : MonoBehaviour
public void Consumed() 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() public void OnPatternFinished()
{
if (gameObject.activeSelf)
{ {
CurrentPattern++; CurrentPattern++;
if (CurrentPattern >= patterns.Length) if (CurrentPattern >= patterns.Length)
@@ -42,5 +52,15 @@ public class Enemy : MonoBehaviour
} }
Attack(); Attack();
} }
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.GetComponent<Player>())
{
// okay.. player hit so we're being consumed
Consumed();
}
}
} }