private void updateVisualColors(KeycardColor color) { if (sr != null) { switch (color) { case KeycardColor.Red: sr.sprite = keycardRed; break; case KeycardColor.Green: sr.sprite = keycardGreen; break; case KeycardColor.Blue: sr.sprite = keycardBlue; break; case KeycardColor.Yellow: sr.sprite = keycardYellow; break; } } if (ps != null) { ParticleSystem.MainModule ma = ps.main; Color colorHex = PrefabManager.Instance.getColorHex(color); colorHex.a = 17f / 256f; ma.startColor = colorHex; } }
public void updateKeycard(KeycardColor color, int newCount) { int total = LevelManager.getFloor().keycardTotals[color]; switch (color) { case KeycardColor.Red: redKeycard.SetActive(true); redCounter.text = newCount + "/" + total; break; case KeycardColor.Green: greenKeycard.SetActive(true); greenCounter.text = newCount + "/" + total; break; case KeycardColor.Blue: blueKeycard.SetActive(true); blueCounter.text = newCount + "/" + total; break; case KeycardColor.Yellow: yellowKeycard.SetActive(true); yellowCounter.text = newCount + "/" + total; break; } }
private void updateVisualColors(KeycardColor color) { if (sr != null) { //sr.color = PrefabManager.Instance.getColorHex(color); switch (color) { case KeycardColor.Red: sr.sprite = keycardsByColor[0]; break; case KeycardColor.Green: sr.sprite = keycardsByColor[1]; break; case KeycardColor.Blue: sr.sprite = keycardsByColor[2]; break; case KeycardColor.Yellow: sr.sprite = keycardsByColor[3]; break; } } }
public void tryToUnlock(KeycardColor color) { if (keycardsRequired.Remove(color) && keycardsRequired.Count == 0) { Vector2Int truePos = (Floor.pos3dToVect2Int(transform.position)); LevelManager.getFloor().updateFgGridForAllPos(null, truePos, additionalCoords, false); // TODO - Add interact / fadeout animation if desired // For now: gameObject.SetActive(false); } }
// Keycard management public static void obtainKeycard(KeycardColor color) { GM.Instance.currentLevelManager.obtainedKeycards[color]++; int newTotal = GM.Instance.currentLevelManager.obtainedKeycards[color]; if (newTotal == LevelManager.getFloor().keycardTotals[color]) { foreach (LockedDoor lockedDoor in getFloor().lockedDoors) { lockedDoor.tryToUnlock(color); } } IngameCanvas.Instance.updateKeycard(color, newTotal); }
public Color getColorHex(KeycardColor color) { switch (color) { case KeycardColor.Red: return(redHex); case KeycardColor.Green: return(greenHex); case KeycardColor.Blue: return(blueHex); case KeycardColor.Yellow: return(yellowHex); } return(Color.black); }
// Keycard displays public void initKeycard(KeycardColor color) { updateKeycard(color, 0); }