Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit, 100))
            {
                LevelSelector tmp;
                tmp = hit.transform.gameObject.GetComponent <LevelSelector>();
                if (tmp && !tmp.is_lock)
                {
                    current = tmp;
                    Debug.Log("levelLaunched");
                    current.launchLevel();
                }
                else if (tmp)
                {
                    //tmp.lockLevel(false);
                }
            }
        }

        if (Input.GetKey(KeyCode.R))
        {
            PlayerPrefs.SetInt("tounlockLevel", 1);
            PlayerPrefs.SetInt("unlockedLevel", 0);
        }

        // List<GameObject> tmpParticleList = new List<GameObject>() ;
        // foreach(GameObject particle in particleList)
        // {
        //  Light tmpLight = particle.GetComponent<Transform>().GetChild(1).GetComponent<Light>();
        //  tmpLight.range -= 0.01f;
        //  if (tmpLight.range <= 0.1f)
        //  {
        //      Destroy(particle);
        //  }
        //  else
        //  {
        //      tmpParticleList.Add(particle);
        //  }
        // }
        // particleList = tmpParticleList;
        if (particleList.Count != 0)
        {
            StartCoroutine(HandleLevelParticles());
        }
    }