public void PlantSeed() { if (State.gameState == GameState.win || State.gameState == GameState.loss) { return; } ColorID seedColorID = ActorGameManager.currentPlayerColorID; if (seedColorID == ColorID.white) { // erasing if (hexagonColor == ColorID.white) { return; } SetColor(6, seedColorID); if (State.gameState == GameState.play) { GameObject.FindGameObjectWithTag("AudioManager").GetComponentInChildren <ActorAudioManager>().playPlanted(); } } else { // planting if (hexagonColor != ColorID.white) { return; } SetColor(6, seedColorID); foreach (KeyValuePair <int, ActorHexagon> p in petals) { p.Value.GrowPetal(p.Key, seedColorID); } ActorGameManager.AddScore(ActorGameManager.seedsPlanted, 1); ActorGameManager.RecordSeedPlanted(hexagonID, seedColorID); ActorGameManager.CheckWinLose(); if (State.gameState == GameState.play) { GameObject.FindGameObjectWithTag("AudioManager").GetComponentInChildren <ActorAudioManager>().playPlanted(); } } return; }
public void GrowPetal(int rotation, ColorID seedColorID) { // early exit if hexagon color is already this color so no points are scored if (hexagonColor == seedColorID) { return; } if (hexagonColor == ColorID.white) { SetColor(rotation, seedColorID); ActorGameManager.AddScore(ActorGameManager.petalCount, 1); } else { SetColor(0, ColorID.white); ActorGameManager.AddScore(ActorGameManager.petalCount, -1); ActorGameManager.AddScore(ActorGameManager.petalExplosions, 1); SpawnPetalExplosion(); } return; }