|
|
@@ -101,6 +101,7 @@ namespace Subworlds
|
|
|
chunks[num] = new GameObject("chunk");
|
|
|
var chunk = chunks[num].AddComponent<Chunk>();
|
|
|
PopulateWorld(chunk);
|
|
|
+ chunk.StartCoroutine(Meteors());
|
|
|
num++;
|
|
|
}
|
|
|
}
|
|
|
@@ -277,6 +278,10 @@ namespace Subworlds
|
|
|
var position = new Vector3((float)(242 + x * 4 - 60), y * 4 - 60 + GetSizeForPixels(54) + 1.049f, 0f);
|
|
|
|
|
|
if (random.Next(2) == 0)
|
|
|
+ {
|
|
|
+ Network.Instantiate(Resources.Load("e/Subworlds/Jelly"), position, Quaternion.identity, 0);
|
|
|
+ }
|
|
|
+ else if (random.Next(2) == 0)
|
|
|
{
|
|
|
networkStuff[temp] = (GameObject)Network.Instantiate(Resources.Load("obj/Subworlds/SpaceOre1"), position, Quaternion.identity, 0);
|
|
|
temp++;
|
|
|
@@ -307,5 +312,28 @@ namespace Subworlds
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private static IEnumerator Meteors()
|
|
|
+ {
|
|
|
+ yield return new WaitForSeconds((float)UnityEngine.Random.Range(1, 5));
|
|
|
+ if (Network.isServer && MenuScript.player != null)
|
|
|
+ {
|
|
|
+ while (true)
|
|
|
+ {
|
|
|
+ if (GameScript.isTown || !GameScript.inInstance)
|
|
|
+ break;
|
|
|
+ Vector3 spawnPos = new Vector3(MenuScript.player.transform.position.x + (float)UnityEngine.Random.Range(-20, 70), MenuScript.player.transform.position.y + 40f, 0f);
|
|
|
+ GameObject p;
|
|
|
+ if (UnityEngine.Random.Range(0, 3) == 0)
|
|
|
+ p = (GameObject)Network.Instantiate(Resources.Load("proj/meteor"), spawnPos, Quaternion.identity, 0);
|
|
|
+ else
|
|
|
+ p = (GameObject)Network.Instantiate(Resources.Load("proj/meteor2"), spawnPos, Quaternion.identity, 0);
|
|
|
+ Vector3 target = new Vector3(MenuScript.player.transform.position.x + (float)UnityEngine.Random.Range(-20, 70), MenuScript.player.transform.position.y, 0f);
|
|
|
+ p.SendMessage("EnemySet", target, SendMessageOptions.DontRequireReceiver);
|
|
|
+ yield return new WaitForSeconds(1f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ yield break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|