public void AddCrystal(Crystal.CrystalColor color) { switch (color) { case Crystal.CrystalColor.Red: _crystalRed = true; break; case Crystal.CrystalColor.Blue: _crystalBlue = true; break; case Crystal.CrystalColor.Green: _crystalGreen = true; break; } }
public bool checkLaserFire(Crystal.CrystalColor color) { if (currentLayer == 4) { if (layer4Color == color) { layer4Explosion.SetActive(true); currentLayer = 3; layer4.SetActive(false); layer3.SetActive(true); isInterrupted = true; // cannot continue until you do the interruption // hampster go! return(true); } } else if (currentLayer == 3) { if (layer3Color == color) { layer3Explosion.SetActive(true); currentLayer = 2; layer3.SetActive(false); layer2.SetActive(true); isInterrupted = true; // cannot continue until you do the interruption fire.SetActive(true); return(true); } } else if (currentLayer == 2) { if (layer2Color == color) { layer2Explosion.SetActive(true); currentLayer = 1; layer2.SetActive(false); layer1.SetActive(true); isInterrupted = true; // cannot continue until you do the interruption return(true); } } else if (currentLayer == 1) { if (layer1Color == color) { layer1Explosion.SetActive(true); currentLayer = 0; layer1.SetActive(false); isInterrupted = true; // cannot continue until you do the interruption batteryOpen.StartCoroutine(batteryOpen.openPanel()); return(true); } } else if (currentLayer == 0) { planetExplosion.SetActive(true); currentLayer = -1; planet.SetActive(false); return(true); //rainbow laser for final shot? } else { return(false); } return(false); }
public IEnumerator LaserFire() { if (laserCrystal != null) { switch (laserCrystal.GetComponent <Crystal> ().color) { case Crystal.CrystalColor.Blue: laserV3D.finalColor = new Color(0, 0, 255 / 255.0f); storedColor = Crystal.CrystalColor.Blue; break; case Crystal.CrystalColor.BlueGreen: laserV3D.finalColor = new Color(0, 255 / 255.0f, 127 / 255.0f); storedColor = Crystal.CrystalColor.BlueGreen; break; case Crystal.CrystalColor.BlueViolet: laserV3D.finalColor = new Color(64 / 255.0f, 0, 255 / 255.0f); storedColor = Crystal.CrystalColor.BlueViolet; break; case Crystal.CrystalColor.Green: laserV3D.finalColor = new Color(0, 255 / 255.0f, 0); storedColor = Crystal.CrystalColor.Green; break; case Crystal.CrystalColor.Orange: laserV3D.finalColor = new Color(255 / 255.0f, 127 / 255.0f, 0); storedColor = Crystal.CrystalColor.Orange; break; case Crystal.CrystalColor.Red: laserV3D.finalColor = new Color(255 / 255.0f, 0, 0); storedColor = Crystal.CrystalColor.Red; break; case Crystal.CrystalColor.RedOrange: laserV3D.finalColor = new Color(255 / 255.0f, 64 / 255.0f, 0); storedColor = Crystal.CrystalColor.RedOrange; break; case Crystal.CrystalColor.RedViolet: laserV3D.finalColor = new Color(191 / 255.0f, 0, 255 / 255.0f); storedColor = Crystal.CrystalColor.RedViolet; break; case Crystal.CrystalColor.Violet: laserV3D.finalColor = new Color(127 / 255.0f, 0, 255 / 255.0f); storedColor = Crystal.CrystalColor.Violet; break; case Crystal.CrystalColor.Yellow: laserV3D.finalColor = new Color(255 / 255.0f, 255 / 255.0f, 0); storedColor = Crystal.CrystalColor.Yellow; break; case Crystal.CrystalColor.YellowGreen: laserV3D.finalColor = new Color(191 / 255.0f, 255 / 255.0f, 0); storedColor = Crystal.CrystalColor.YellowGreen; break; case Crystal.CrystalColor.YellowOrange: laserV3D.finalColor = new Color(255 / 255.0f, 191 / 255.0f, 0); storedColor = Crystal.CrystalColor.YellowOrange; break; } isFiring = true; lights.SetActive(true); laserV3D.always = true; yield return(new WaitForSeconds(5.0f)); if (gm.checkLaserFire(storedColor)) { if (gm.currentLayer == 0) { StartCoroutine(RainbowLaser()); } if (gm.currentLayer != 0) { Destroy(laserCrystal); } } if (gm.currentLayer != -1) { lights.SetActive(false); laserV3D.always = false; } isFiring = false; } }