void ShootToward() { GameObject obj1 = objPool.GetPooledObject(); if (obj1 == null) { return; } obj1.transform.position = bulletSpawn1.position; obj1.GetComponent <BulletScript>().Direction = new Vector2((Player.transform.position - bulletSpawn1.position).x - 2, (Player.transform.position - bulletSpawn1.position).y).normalized; obj1.SetActive(true); GameObject obj2 = objPool.GetPooledObject(); if (obj2 == null) { return; } obj2.transform.position = bulletSpawn2.position; obj2.GetComponent <BulletScript>().Direction = (Player.transform.position - bulletSpawn2.position).normalized; obj2.SetActive(true); GameObject obj3 = objPool.GetPooledObject(); if (obj3 == null) { return; } obj3.transform.position = bulletSpawn3.position; obj3.GetComponent <BulletScript>().Direction = new Vector2((Player.transform.position - bulletSpawn3.position).x + 2, (Player.transform.position - bulletSpawn1.position).y).normalized; obj3.SetActive(true); }
void ShootToward() { GameObject obj1 = bulletObjPool.GetPooledObject(); if (obj1 == null) { return; } obj1.transform.position = bulletSpawn1.position; obj1.GetComponent <BulletScript>().Direction = (Player.transform.position - bulletSpawn1.position).normalized; obj1.SetActive(true); }
IEnumerator Spawn(ObjectPoolerScript objPool, Vector2 position, float time) { yield return(new WaitForSeconds(time)); GameObject NewEnemy = objPool.GetPooledObject(); NewEnemy.SetActive(true); NewEnemy.transform.position = position; }
void ShootPower() { //Shoots 5 bullets GameObject obj1 = objPool.GetPooledObject(); if (obj1 == null) { return; } obj1.transform.position = bulletSpawn1.position; obj1.GetComponent <BulletScript>().Direction = new Vector2(1, 0); obj1.SetActive(true); GameObject obj2 = objPool.GetPooledObject(); if (obj2 == null) { return; } obj2.transform.position = bulletSpawn2.position; obj2.GetComponent <BulletScript>().Direction = new Vector2(1, 0); obj2.SetActive(true); GameObject obj3 = objPool.GetPooledObject(); if (obj3 == null) { return; } obj3.transform.position = bulletSpawn3.position; obj3.GetComponent <BulletScript>().Direction = new Vector2(1, 0); obj3.SetActive(true); GameObject obj4 = objPool.GetPooledObject(); if (obj4 == null) { return; } obj4.transform.position = bulletSpawn4.position; obj4.GetComponent <BulletScript>().Direction = new Vector2(1, 0); obj4.SetActive(true); GameObject obj5 = objPool.GetPooledObject(); if (obj5 == null) { return; } obj5.transform.position = bulletSpawn5.position; obj5.GetComponent <BulletScript>().Direction = new Vector2(1, 0); obj5.SetActive(true); }
void AddHuman(int num) { for (int i = 0; i < num; i++) { if (humanCount < 21) { GameObject human = m_humanPool.GetPooledObject(); human.GetComponent <Human>().Init(); humanCount++; } } }
public void Death() { //Used by HealthScript GameControllerScript.GC.Score += Mathf.RoundToInt(ScoreValue ^ (1 + (GameControllerScript.GC.ComboInt / 10))); GameControllerScript.GC.ComboInt += 1; GameControllerScript.GC.chainTimer = GameControllerScript.GC.maxChainTimer; GameObject Boom = explosionObjPool.GetPooledObject(); if (Boom == null) { return; } Boom.transform.position = transform.position + new Vector3(0, 0, -5); Boom.SetActive(true); }
void AddHelper() { GameObject obstacle = m_helperPool.GetPooledObject(); obstacle.GetComponent <Helper>().Init(); }
void AddObstacle() { GameObject obstacle = m_obstaclePool.GetPooledObject(); obstacle.GetComponent <Obstacle>().Init(); }