Ejemplo n.º 1
0
    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;
    }