예제 #1
0
    public override void OnInspectorGUI()
    {
        Parkour parkour = (Parkour)target;

        base.OnInspectorGUI();

        for (int j = 0; j < 4; j++)
        {
            if (j < parkour.medals.Length)
            {
                if (parkour.medals[j].type != (Medal.MedalType)j)
                {
                    EditorGUILayout.HelpBox("Medal at index " + j + " should be of type " + Medal.MedalTypeToString((Medal.MedalType)j), MessageType.Error);
                }
            }
            else
            {
                EditorGUILayout.HelpBox(Medal.MedalTypeToString((Medal.MedalType)j) + " Medal is missing", MessageType.Error);
            }
        }

        int min = parkour.startingScore;
        int i   = 0;

        while (i < parkour.medals.Length)
        {
            if (parkour.medals[i].score > min)
            {
                EditorGUILayout.HelpBox(Medal.MedalTypeToString(parkour.medals[i].type) + " Medal score should not be higher than previous medal", MessageType.Error);
                break;
            }
            min = parkour.medals[i].score;
            i++;
        }
    }
예제 #2
0
    void Init()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy(Instance.gameObject);
            Instance = this;
        }
        foreach (GameObject pathPoint in pathPoints)
        {
            pathPoint.SetActive(false);
        }
        startPoint.SetActive(true);
        UIManager.Instance.promptText.SetActive(true);
        timer         = UIManager.Instance.timer;
        parkourCanvas = UIManager.Instance.parkourCanvas;
        success       = false;
        timer.gameObject.SetActive(false);
        UIManager.Instance.successText.SetActive(false);
        UIManager.Instance.failureText.SetActive(false);
        alphaIncrease = false;
        Color c = pathPointMaterial.color;
        Color d = endPointMaterial.color;

        c.a = (maxAlpha + minAlpha) / 2;
        d.a = (maxAlpha + minAlpha) / 2;
        pathPointMaterial.color = c;
        endPointMaterial.color  = d;
    }