Пример #1
0
    void Start()
    {
        cObj = GetComponent <ReverseCharacterController>();
        rObj = GameObject.Find("God").GetComponent <ReverseResetLevel>();
        anim = GetComponent <Animator>();
        sObj = GetComponent <ReverseScore>();
        hObj = GetComponent <ReverseHealth>();
        tObj = GetComponent <ReverseTimer>();
        if (SceneManager.GetActiveScene().name == "Level1" && !(PlayerPrefs.GetInt("Level Reached") > 1))
        {
            PlayerPrefs.SetInt("Level Reached", 1);
        }
        else if (SceneManager.GetActiveScene().name == "Level2" && !(PlayerPrefs.GetInt("Level Reached") > 2))
        {
            PlayerPrefs.SetInt("Level Reached", 2);
        }
        else if (SceneManager.GetActiveScene().name == "Level3" && !(PlayerPrefs.GetInt("Level Reached") > 3))
        {
            PlayerPrefs.SetInt("Level Reached", 3);
        }
        else if (SceneManager.GetActiveScene().name == "Level4" && !(PlayerPrefs.GetInt("Level Reached") > 4))
        {
            PlayerPrefs.SetInt("Level Reached", 4);
        }
        else if (SceneManager.GetActiveScene().name == "Level5")
        {
            PlayerPrefs.SetInt("Level Reached", 5);
        }
        if (SceneManager.GetActiveScene().name == "Level5")
        {
            wObj = GetComponent <Wind>();
        }
        lObj = GameObject.Find("Chest").GetComponent <NextLevel>();

        sr = GetComponent <SpriteRenderer>();

        srOrigColor = sr.color;

        sprites = GetComponentsInChildren <SpriteRenderer>();

        /*for (int i=0; i < spriteRenderers.Count; ++i) {
         *  colors.Add(spriteRenderers.material.color);
         *  renderer.material.color = new Color(1,1,1,0.5f);
         * }*/
    }
Пример #2
0
 void Awake()
 {
     gObj = GameObject.Find("Player").GetComponent <ReversePlayerMovement>(); // instantiate to access Player
     sObj = GameObject.Find("Player").GetComponent <ReverseScore>();
     hObj = GameObject.Find("Player").GetComponent <ReverseHealth>();
 }