diff --git a/Assets/Game1.unity b/Assets/Game1.unity index 731bdab..a1eb8cb 100644 Binary files a/Assets/Game1.unity and b/Assets/Game1.unity differ diff --git a/Assets/Game2.unity b/Assets/Game2.unity index 199b4ff..ff9dbb0 100644 Binary files a/Assets/Game2.unity and b/Assets/Game2.unity differ diff --git a/Assets/Game3.unity b/Assets/Game3.unity index 86a0b72..f27cbfa 100644 Binary files a/Assets/Game3.unity and b/Assets/Game3.unity differ diff --git a/Assets/Game4.unity b/Assets/Game4.unity index 207b8e5..363e5d5 100644 Binary files a/Assets/Game4.unity and b/Assets/Game4.unity differ diff --git a/Assets/Levels.cs b/Assets/Levels.cs index d1fe60f..117abf4 100644 --- a/Assets/Levels.cs +++ b/Assets/Levels.cs @@ -4,11 +4,11 @@ using UnityEngine; using UnityEngine.SceneManagement; -public class Levels : NetworkBehaviour +public class Levels : NetworkManager { public static int level = 0; - public int lastCount = -1; - + public int lastCount = 0; + /* // Use this for initialization void Start () { @@ -45,19 +45,19 @@ void CmdNextLevel() { RpcNextLevel(); } - + */ // Update is called once per frame void Update () { - if (RockSphere.count != lastCount) - { - lastCount = RockSphere.count; - Debug.Log("Rocks " + lastCount + " " + Random.Range(0.0f, 1.0f).ToString()); - if (RockSphere.count == 0) + if (RockSphere.count != lastCount) { - Debug.Log("Rocks " + lastCount); - RpcNextLevel(); + lastCount = RockSphere.count; + if (RockSphere.count == 0) + { + //ServerChangeScene("Game2"); + // NextLevel(); + //RpcNextLevel(); + } } - } } } diff --git a/Assets/NetworkManagerRocket.cs b/Assets/NetworkManagerRocket.cs index 53f074f..2babaa9 100644 --- a/Assets/NetworkManagerRocket.cs +++ b/Assets/NetworkManagerRocket.cs @@ -34,4 +34,26 @@ public override void OnStopHost() if (RockField2 != null) NetworkServer.Destroy(RockField2); } + + public static int level = 1; + public int lastCount = 0; + + void Update() + { + if (RockSphere.count != lastCount) + { + lastCount = RockSphere.count; + if (RockSphere.count == 0) + { + level++; + if (level > 3) + { + level = 1; + } + + ServerChangeScene("Game" + level); + } + } + } + } \ No newline at end of file diff --git a/Assets/RockSphere.cs b/Assets/RockSphere.cs index ba69c63..fcc2b5f 100644 --- a/Assets/RockSphere.cs +++ b/Assets/RockSphere.cs @@ -86,7 +86,6 @@ void Start() } count++; - Debug.Log("Add Rocks " + count + " " + Random.Range(0.0f, 1.0f).ToString()); } [ServerCallback] @@ -100,7 +99,6 @@ void OnTriggerEnter(Collider other) destroyed = true; NetworkServer.Destroy(transform.gameObject); count--; - Debug.Log("Destroy Rocks " + count + " " + Random.Range(0.0f, 1.0f).ToString()); if (rockSpherePrefab) {