IEnumerator SpawnWaves()
    {
        while (pickupCount < 5)
        {
            Vector3    spawnPosition = new Vector3(Random.Range(-spawnValues.x, spawnValues.x), spawnValues.y, Random.Range(-spawnValues.z, spawnValues.z));
            Quaternion spawnRotation = Quaternion.identity;
            Instantiate(pickup, spawnPosition, spawnRotation);
            yield return(new WaitForSeconds(spawnWait));

            getCount    = GameObject.FindGameObjectsWithTag("Pickup");
            pickupCount = getCount.Length;

            GameObject Player    = GameObject.Find("Player");
            PickingUp  pickingUp = Player.GetComponent <PickingUp>();

            if (pickingUp.IsDestroyed == true)
            {
                pickupCount -= 1;
            }
        }
    }
    [SerializeField] protected int _healingPower = 1; //protected to create larger healing kits

    #endregion

    #region Methods

    protected override bool PickUp()
    {
        return(PickingUp.Invoke(Item, Count));
    }
示例#3
0
 // Start is called before the first frame update
 void Start()
 {
     pickingUp = GetComponent <PickingUp>();
     score     = FindObjectOfType <Score>();
     fuel      = FindObjectOfType <Timer>();
 }