public Orb MakeGhostOrb(Orb primaryOrb, Orb[] otherOrbs) { StoryManager storyManager = FindObjectOfType <StoryManager>(); if (storyManager.storyBeat == StoryManager.Beat.FREE_PLAY_2) { storyManager.GotoBeat(StoryManager.Beat.INTERLUDE_2_PABS_EMERGE, 2f); } Orb ghostOrb = this.inactiveGhostOrbs.Pop(); ghostOrb.AddChildOrb(primaryOrb); for (int i = 0; i < otherOrbs.Length; i++) { ghostOrb.AddChildOrb(otherOrbs[i]); } primaryOrb.item.state = Item.State.TRANSFORMED; for (int i = 0; i < otherOrbs.Length; i++) { otherOrbs[i].item.state = Item.State.TRANSFORMED; } ghostOrb.item.transform.position = primaryOrb.transform.position; ghostOrb.item.initialPosition = ghostOrb.item.transform.position; return(ghostOrb); }
private void SpawnMonster() { if (this.orbs.Count == 2) { GameObject spawnedObj = null; if (orbs[0].orbColor == Orb.OrbColor.BLUE && orbs[1].orbColor == Orb.OrbColor.BLUE) { spawnedObj = Instantiate(PrefabManager.GHOST_SLUG_PREFAB, (Vector2)this.spawnWaypoint.transform.position, Quaternion.identity); } else if (orbs[0].orbColor == Orb.OrbColor.RED && orbs[1].orbColor == Orb.OrbColor.RED) { spawnedObj = Instantiate(PrefabManager.LIVING_FLAME_PREFAB, (Vector2)this.spawnWaypoint.transform.position, Quaternion.identity); } else if (orbs[0].orbColor == Orb.OrbColor.BROWN && orbs[1].orbColor == Orb.OrbColor.BROWN) { spawnedObj = Instantiate(PrefabManager.COPYCAT_PREFAB, (Vector2)this.spawnWaypoint.transform.position, Quaternion.identity); } else if ((orbs[0].orbColor == Orb.OrbColor.BLUE && orbs[1].orbColor == Orb.OrbColor.RED) || (orbs[0].orbColor == Orb.OrbColor.RED && orbs[1].orbColor == Orb.OrbColor.BLUE)) { StoryManager storyManager = FindObjectOfType <StoryManager>(); if (storyManager.storyBeat == StoryManager.Beat.FREE_PLAY_1) { storyManager.GotoBeat(StoryManager.Beat.INTERLUDE_1_PABS_EMERGE, 2f); orbs[0].item.ReturnToLab(); orbs[1].item.ReturnToLab(); } else { spawnedObj = Instantiate(PrefabManager.GOBLIN_PREFAB, (Vector2)this.spawnWaypoint.transform.position, Quaternion.identity); } } else if ((orbs[0].orbColor == Orb.OrbColor.BLUE && orbs[1].orbColor == Orb.OrbColor.BROWN) || (orbs[0].orbColor == Orb.OrbColor.BROWN && orbs[1].orbColor == Orb.OrbColor.BLUE)) { spawnedObj = Instantiate(PrefabManager.PLANT_OGRE_PREFAB, (Vector2)this.spawnWaypoint.transform.position, Quaternion.identity); } else if ((orbs[0].orbColor == Orb.OrbColor.RED && orbs[1].orbColor == Orb.OrbColor.BROWN) || (orbs[0].orbColor == Orb.OrbColor.BROWN && orbs[1].orbColor == Orb.OrbColor.RED)) { spawnedObj = Instantiate(PrefabManager.FIRE_SALAMANDER_PREFAB, (Vector2)this.spawnWaypoint.transform.position, Quaternion.identity); } else if ((orbs[0].orbColor == Orb.OrbColor.WHITE && orbs[1].orbColor != Orb.OrbColor.WHITE) || (orbs[0].orbColor != Orb.OrbColor.WHITE && orbs[1].orbColor == Orb.OrbColor.WHITE)) { spawnedObj = Instantiate(PrefabManager.GHOST_PREFAB, (Vector2)this.spawnWaypoint.transform.position, Quaternion.identity); } else if (orbs[0].orbColor == Orb.OrbColor.WHITE && orbs[1].orbColor == Orb.OrbColor.WHITE) { StoryManager storyManager = FindObjectOfType <StoryManager>(); if (storyManager.storyBeat == StoryManager.Beat.FREE_PLAY_4) { storyManager.GotoBeat(StoryManager.Beat.ENDING_PABS_EMERGE, 2f); orbs[0].item.ReturnToLab(); orbs[1].item.ReturnToLab(); } else { orbs[0].item.ReturnToLab(); orbs[1].item.ReturnToLab(); } } if (spawnedObj != null) { Monster spawnedMonster = spawnedObj.GetComponent <Monster>(); if (spawnedMonster != null) { Orb[] monsterOrbs = { this.orbs[0], this.orbs[1] }; spawnedMonster.GiveOrbs(monsterOrbs); } this.voido.EjectMonster(spawnedMonster); } // orbs are no longer in machine this.orbs.Clear(); } }