示例#1
0
    // Use this for initialization
    void Start()
    {
        leadermovement = leader.GetComponent <LeadVehicleMovement>();
        spawns         = spawnArea.GetComponent <SpawnLocations>();

        for (int i = 0; i < numberToSpawnAtStart; i++)
        {
            Vector3    pos     = spawns.getSpawnLocation();
            Quaternion rot     = transform.rotation;        //new Quaternion(0f,0f,0f,0f);
            GameObject tempobj = Instantiate(Resources.Load("prefabs/pickup"), pos, rot) as GameObject;
        }
    }
示例#2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Player"))
     {
         convoylist1.increaseLength();
         //spawn another pickup
         SpawnLocations spawns  = GameObject.FindObjectOfType(typeof(SpawnLocations)) as SpawnLocations;
         Vector3        pos     = spawns.getSpawnLocation();
         Quaternion     rot     = transform.rotation;    //new Quaternion(0f,0f,0f,0f);
         GameObject     tempobj = Instantiate(Resources.Load("prefabs/pickup"), pos, rot) as GameObject;
         so.GetComponent <AudioSource>().Play();
         ScoreInfo.Score += 1;
         Destroy(this.gameObject);
     }
 }