// Update is called once per frame
 void Update()
 {
     if (myTransform == null)
     {
         return;
     }
     if (myTransform.position.z > -100)
     {
         myTransform.Translate(Vector3.up * speed * Time.deltaTime);
     }
     //this allows us to keeep a copy of the obstacle at < -200 that does not move but allows others to be created
     if ((myTransform.position.z < -100) && (myTransform.position.z > -200))
     {
         wNr.setFlagNext(true);
         Destroy(obstacle);
     }
 }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        if (myTransform == null)
        {
            return;
        }
        if (myTransform.position.z > -100)
        {
            myTransform.Translate(Vector3.left * speed * Time.deltaTime);
        }

        if ((myTransform.position.z < -100) && (myTransform.position.z > -200))
        {
            wNr.setFlagNext(true);
            Destroy(obstacle);
            //Destroy(obstacle);
        }
    }