Пример #1
0
    public void hit()
    {
        if (!has_played)
        {
            //Debug.Log("HIT"+this.idx);
            // MusicSource.Play();
            Destroy(transform.Find("model3D").gameObject);
            has_played = true;

            //Debug.Log("turn on light:" + this.idx.ToString());
            List <GameObject> lights = Lamp_Light_scpt.getlights(this.idx);

            foreach (GameObject light in lights)
            {
                flare_scpt fscpt = myPrefab.gameObject.GetComponent <flare_scpt>();
                fscpt.beginpos  = this.transform.position;
                fscpt.endpos    = light.transform.position;
                fscpt.light_idx = this.idx;

                // GameObject flare = Instantiate(myPrefab, fscpt.beginpos, Quaternion.identity);
            }



            Lamp_Light_scpt.turn_on_lights(this.idx);
        }
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        curtime = Time.time - begintime;
        float a = curtime / duration;


        if (a > 1)
        {
            a = 1;
            Lamp_Light_scpt.turn_on_lights(light_idx);
        }



        this.transform.position = (1 - a) * beginpos + a * endpos;
        //Debug.Log(this.transform.position);
    }