IEnumerator FireBurst() { for (int i = 0; i < numRounds; i++) { PoolingManager.InstantiatePooled(bulletPrefab, transform.position, transform.rotation); yield return(new WaitForSeconds(burstRate)); } }
private void OnTriggerEnter2D(Collider2D other) { if (hitParticle != null && other.tag != "Border") { PoolingManager.InstantiatePooled(hitParticle, other.transform.position, Quaternion.identity); } Health objHealth = other.GetComponent <Health>(); if (objHealth != null) { objHealth.TakeDamage(power); } }
void ShootForward() { PoolingManager.InstantiatePooled(bulletPrefab, transform.position, transform.rotation); /* * GameObject obj = ObjectPooler.current.GetPooledObjects(bulletPrefab); * if (obj == null) return; * //GameObject newObj = bsc.ChangeSprite(obj); * * obj.transform.position = transform.position; * obj.transform.rotation = transform.rotation; * obj.transform.gameObject.SetActive(true); */ }
void Spawn() { if (GetComponent <Health>().currentHealth != 0) // cancel event if enemy is still alive { return; } else { for (int i = 0; i < qtyToSpawn; i++) { //Debug.Log("spawned"); Vector3 randPos = GenerateRandomPos(); PoolingManager.InstantiatePooled(lootPrefab, randPos, transform.rotation); //Instantiate(lootPrefab, transform.position, transform.rotation); } } }