Wave system

This commit is contained in:
JonatanRek 2020-02-01 20:14:33 +01:00
parent ca2f1f48c0
commit 5524ac7365
6 changed files with 17 additions and 1 deletions

View File

@ -11,6 +11,8 @@ public class DayManager : MonoBehaviour
public AudioClip dayClip;
public AudioClip nigtClip;
public int daySurvived = 0;
// Start is called before the first frame update
void Start()
{
@ -35,6 +37,7 @@ public class DayManager : MonoBehaviour
Debug.Log("It is a Day");
mainSource.PlayOneShot(dayClip);
night = false;
daySurvived++;
}
this.gameObject.transform.Rotate(new Vector3(sunSpeed * Time.deltaTime, 0, 0));

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 41e45d644c0cd4b4a8133c39c3ebcfa8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -7,9 +7,10 @@ public class SpawnManager : MonoBehaviour
public List<GameObject> enemyList = new List<GameObject>();
public List<Transform> spawnPoints = new List<Transform>();
public int enemyNumber = 10;
public int enemyStartNumber = 5;
public GameObject Sun = new GameObject();
bool night = false;
bool alreadySpawn = false;
@ -22,6 +23,7 @@ public class SpawnManager : MonoBehaviour
// Update is called once per frame
void Update()
{
int enemyNumber = enemyStartNumber + (Sun.GetComponent<DayManager>().daySurvived * enemyStartNumber);
float sunRotationX = Sun.transform.localEulerAngles.x;
sunRotationX = (sunRotationX > 180) ? sunRotationX - 360 : sunRotationX;