예제 #1
0
    private void increment_jumps()
    {
        // increment jumps after every 4 levels
        // jumps are persisted
        // show message if nre jump count is greater than current jump count
        bool show_bonus = false;
        int  level      = SceneManager.GetActiveScene().buildIndex;

        if (level == 4 && max_jumps == 2)
        {
            show_bonus = true;
        }
        else if (level == 8 && max_jumps == 3)
        {
            show_bonus = true;
        }
        else if (level == 12 && max_jumps == 4)
        {
            show_bonus = true;
        }
        else if (level == 16 && max_jumps == 5)
        {
            show_bonus = true;
        }
        else if (level == 20 && max_jumps == 6)
        {
            show_bonus = true;
        }

        if (show_bonus)
        {
            GameObject wp = GameObject.Find("WinPanel");
            wp.transform.GetChild(1).gameObject.SetActive(true);
            Save_game obj = new Save_game();
            max_jumps = max_jumps + 1;
        }
        if (level > levels_cleared)
        {
            levels_cleared = level;
        }
        Save_game obj1 = new Save_game();

        obj1.SaveFile(max_jumps, levels_cleared);
    }
예제 #2
0
    private void Start()
    {
        // set PlayerMaterial color to true
        // rb.velocity = new Vector3(0, 0, forwardForce);
        // TrueState = Random.ColorHSV();
        // FalseState = Random.ColorHSV();

        Save_game obj = new Save_game();

        // obj.SaveFile(6,0);
        obj.LoadFile();//update from saved file
        max_jumps      = obj.get_jumps();
        levels_cleared = obj.get_levels_cleared();
        // Debug.Log(max_jumps);
        // max_jumps = 6;  //  hard coded for testing

        trueMat.SetColor("_Color", TrueState);
        falseMat.SetColor("_Color", FalseState);
        PlayerMat.SetColor("_Color", FalseState);
    }
예제 #3
0
    // Start is called before the first frame update
    void Start()
    {
        Save_game obj = new Save_game();

        obj.LoadFile();
        levels_cleared = obj.get_levels_cleared();
        Debug.Log(levels_cleared);

        for (int i = 1; i <= total_levels; i++)
        {
            string s   = "lvl (" + i.ToString() + ")";
            Image  btn = GameObject.Find(s).GetComponent <Image>();
            if (i <= levels_cleared + 1)
            {
                btn.sprite = unlocked;
            }
            else
            {
                btn.sprite = locked;
            }
            // Debug.Log(btn);
        }
    }