示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        Spawnner spawnnerScript = GameObject.FindGameObjectWithTag("Spawnner")
                                  .GetComponent <Spawnner>(); // note - Spawnner here is name of the script

        // used to select random value in the range (maxSpeed not inc)
        speed = Random.Range(minSpeed, maxSpeed) + spawnnerScript.getAddedSpeed();

        playerScript = GameObject.FindGameObjectWithTag("Player")
                       .GetComponent <Player>(); // note - Player here is name of the script
    }
示例#2
0
 void setlane()
 {
     Spawnner[] spawnner = GameObject.FindObjectsOfType <Spawnner>();
     foreach (Spawnner lane in spawnner)
     {
         if (lane.transform.position.y == this.transform.position.y)
         {
             mylane = lane;
             return;
         }
     }
 }
示例#3
0
 private void Awake()
 {
     Spawnner_Script = GameObject.FindObjectOfType <Spawnner>();
 }