コード例 #1
0
 IEnumerator FireBurst()
 {
     for (int i = 0; i < numRounds; i++)
     {
         PoolingManager.InstantiatePooled(bulletPrefab, transform.position, transform.rotation);
         yield return(new WaitForSeconds(burstRate));
     }
 }
コード例 #2
0
    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);
        }
    }
コード例 #3
0
    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);
         */
    }
コード例 #4
0
 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);
         }
     }
 }