Esempio n. 1
0
    public void StartMatchPuzzle()
    {
        if (isSolved || hasLost || hasWon)
        {
            return;
        }

        //Randomize goal colors
        for (int i = 0; i < (int)SquidPartType.Total; i++)
        {
            SquidPartType t = (SquidPartType)i;

            if (goal.GetPartColor((SquidPartType)i) == Color.clear)
            {
                Debug.Log("goal doesn't contain part of type: " + (SquidPartType)i);
                continue;
            }
            int rand = Random.Range(0, 8);

            switch (rand)
            {
            case 0:
                goal.SetPartColor((SquidPartType)i, Color.grey);
                break;

            case 1:
                goal.SetPartColor((SquidPartType)i, Color.blue);
                break;

            case 2:
                goal.SetPartColor((SquidPartType)i, Color.cyan);
                break;

            case 3:
                goal.SetPartColor((SquidPartType)i, Color.green);
                break;

            case 4:
                goal.SetPartColor((SquidPartType)i, Color.yellow);
                break;

            case 5:
                goal.SetPartColor((SquidPartType)i, Color.red);
                break;

            case 6:
                goal.SetPartColor((SquidPartType)i, Color.magenta);
                break;

            case 7:
                goal.SetPartColor((SquidPartType)i, Color.white);
                break;
            }

            currentPuzzle = PuzzleType.Match;

            prompt.gameObject.SetActive(true);
            prompt.Show();
        }
    }
Esempio n. 2
0
    public Color GetPartColor(SquidPartType type)
    {
        SquidPart part = parts.Find(x => x.GetSquidPartType() == type);

        if (part != null)
        {
            return(part.PartColor);
        }

        return(Color.clear); //No part will ever intentionally be clear.
    }
Esempio n. 3
0
    public void SetPartColor(SquidPartType type, Color c)
    {
        //Make the Squid look pretty for the main menu.
        if (GameController.Instance.State == GameState.MainMenu)
        {
            c = Color.white;
        }

        SquidPart part = parts.Find(x => x.GetSquidPartType() == type);

        part.PartColor = c;
    }