예제 #1
0
        private void FixedUpdate()
        {
            timeSpent += Time.deltaTime;

            if (timeSpent > SpawnRate && currentPickups.Count < maxPickups)
            {
                GameObject tmp           = Instantiate(Pickup);
                Pickups    currentPickup = tmp.GetComponent <Pickups>();
                currentPickup.setPlayer(Player);
                timeSpent = 0;
                currentPickups.Add(currentPickup);
                currentPickup.transform.position = new Vector2((float)randomSign() * Random.Range(2.5f, 5), (float)randomSign() * Random.Range(2.5f, 5));
            }
            nbOfPickups = currentPickups.Count;
        }
예제 #2
0
 // Start is called before the first frame update
 void Start()
 {
     parent = GetComponentInParent <Pickups>();
 }