Skip to content

Commit

Permalink
added score display stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Opitz committed Jun 30, 2018
1 parent 92800e5 commit e4c8987
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 3 deletions.
39 changes: 39 additions & 0 deletions Neonmania/Assets/GUIController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class GUIController : MonoBehaviour {

public Text scoreField;
public Text waveField;

public static int score;
public static int wave;

public void AddScore(int amount)
{
score += amount;
}

public void AddWave()
{

}

// Use this for initialization
void Start()
{
score = 0;
wave = 0;
}

// Update is called once per frame
void Update()
{
scoreField.text = "Score: " + score;
waveField.text = "Wave: " + wave;


}
}
11 changes: 11 additions & 0 deletions Neonmania/Assets/GUIController.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions Neonmania/Assets/Scripts/EnemyController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,23 @@ public class EnemyController : MonoBehaviour {

public float speed = 1f;
public float checkFrequency = 1f;
public GUIController GUI;

public float timeToDie = 1f;
private float timeDead = 0f;
private bool dead = false;


private float lastCheck = 0f;
private Vector3 direction;




// Use this for initialization
void Start () {
}

}

// Update is called once per frame
void Update () {
Expand Down Expand Up @@ -50,8 +55,8 @@ public class EnemyController : MonoBehaviour {
}

public void OnDeath() {
GUI.AddScore(1);
dead = true;

Debug.Log("Dead");
}
}

0 comments on commit e4c8987

Please sign in to comment.