// Use this for initialization void Start() { TerrainFrontStartPosition = TileFront.position; TerrainBackStartPosition = TileBack.position; PlayerStartPosition = Player.transform.position; PlayerStartRotation = Player.transform.rotation; SpawnIslands(TileFront, ref IslandsFront); SpawnIslands(TileBack, ref IslandsBack); if (WaterGridBack != null) { WaterSpawnerBack = WaterGridBack.GetComponent <MassSpawner>(); WaterSystemBack = WaterGridBack.GetComponent <MassSpringSystem>(); } if (WaterGridFront != null) { WaterSpawnerFront = WaterGridFront.GetComponent <MassSpawner>(); WaterSystemFront = WaterGridFront.GetComponent <MassSpringSystem>(); } PlayerForceController = Player.GetComponent <WaterForceController>(); }
void OnLevelWasLoaded(int level) { string curLevel = Application.loadedLevelName; string trgLevel = "ScienceBaseSector"; if (!questAccepted) { PlayerStats.instance.hasActiveQuest = false; Destroy(this.gameObject); return; } if (curLevel == trgLevel) { GUIManager.instance.AddChatMessage(new ChatMessage("Отразите нападение кубоидов, сбив большую часть их кораблей", Color.yellow)); GameObject spawner = new GameObject(); spawner.name = "MassSpawner"; spawner.transform.position = SceneParameters.instance.PlayerSpawnPoint[0] + Random.insideUnitSphere * 50; spawner.AddComponent <MassSpawner>(); MassSpawner sp = spawner.GetComponent <MassSpawner>(); sp.enemy1 = Resources.Load("CuboidScout") as GameObject; sp.enemy2 = Resources.Load("CuboidFighter") as GameObject; } string baseLevel = "ScienceBase"; if (curLevel == baseLevel) { if (goalAchieved) { PlayerStats.instance.money += reward; currentReplica = endReplica; } } }