//Function we can use to spawn Objects public static GameObject SpawnPrefab(SpawnIDs vID, Vector2 vLocation, float vAngle) { int tIndex = (int)vID; //Turn ID into index by casting to int Debug.AssertFormat(tIndex < sSingleton.SpawnablePrefabs.Length, "SpawnID {0} not in Array, did you forget to add prefab?", vID); //Error Quaternion tAngle = Quaternion.Euler(0, 0, vAngle); //Make angle something Unity understands return(Instantiate(sSingleton.SpawnablePrefabs[tIndex], vLocation, tAngle)); //Create it }
public override void Read(BinaryReaderExt r) { base.Read(r); r.Skip(0x2); //x01 01 int spawnCount = r.ReadInt32(); for (int i = 0; i < spawnCount; i++) { r.Skip(1); var shape = new LVDShape(); shape.Read(r); Spawns.Add(shape); } r.Skip(0x2); //x01 01 int zoneCount = r.ReadInt32(); for (int i = 0; i < zoneCount; i++) { r.Skip(1); var shape = new LVDShape(); shape.Read(r); Zones.Add(shape); } r.Skip(0x2); //x01 01 Unknown1 = r.ReadInt32(); //Only seen as 0 r.Skip(1); //x01 ID = r.ReadInt32(); r.Skip(1); //x01 int spawnIdCount = r.ReadInt32(); for (int i = 0; i < spawnIdCount; i++) { r.Skip(1); SpawnIDs.Add(r.ReadInt32()); } r.Skip(1); //x01 Unknown2 = r.ReadInt32(); //Only seen as 0 r.Skip(1); //x01 int zoneIdCount = r.ReadInt32(); for (int i = 0; i < zoneIdCount; i++) { r.Skip(1); ZoneIDs.Add(r.ReadInt32()); } }