protected virtual void SpawnProjectiles() { PoolingManager.Spawn(projectilePrefab, transform.position).GetComponent <Projectile>().Initialize(new Vector3(1, 1).normalized); PoolingManager.Spawn(projectilePrefab, transform.position).GetComponent <Projectile>().Initialize(new Vector3(-1, 1).normalized); PoolingManager.Spawn(projectilePrefab, transform.position).GetComponent <Projectile>().Initialize(new Vector3(1, -1).normalized); PoolingManager.Spawn(projectilePrefab, transform.position).GetComponent <Projectile>().Initialize(new Vector3(-1, -1).normalized); }
void Fire() { Vector3 directionToPlayer = (Player.self.transform.position - transform.position); PoolingManager.Spawn(projectilePrefab, transform.position).GetComponent <Projectile>().Initialize(directionToPlayer); PoolingManager.Spawn(projectilePrefab, transform.position).GetComponent <Projectile>().Initialize((Quaternion.AngleAxis(15, transform.forward) * directionToPlayer)); PoolingManager.Spawn(projectilePrefab, transform.position).GetComponent <Projectile>().Initialize((Quaternion.AngleAxis(-15, transform.forward) * directionToPlayer)); isCharging = false; animator.SetBool(chargingHash, false); }
public override void Spawn() { Vector3 centerPoint = new Vector3(Random.Range(-ScreenBoundary.screenBoundary.x + radius, ScreenBoundary.screenBoundary.x - radius), Random.Range(5f, 9.7f)); float rotationPerEnemy = (Mathf.PI * 2) / amount; for (int i = 0; i < amount; i++) { PoolingManager.Spawn(enemyDifficultyEntry.prefab, centerPoint + new Vector3(Mathf.Cos(rotationPerEnemy * i), Mathf.Sin(rotationPerEnemy * i)).normalized *radius, EnemyHolder.self.transform); } }
private void FireBulletSpawnPosition(Vector3 position) { GameObject spawnedProjectile = PoolingManager.Spawn(playerProjectile, transform.position + position); spawnedProjectile.GetComponent <Projectile>().Initialize(Vector3.up); if (upgradeLevel == 0) { return; } float anglePerUpgradeLevel = (Mathf.PI / 2f) / (upgradeLevel + 1); GameObject projectileToUse = upgradedProjectile; for (int i = 1; i < upgradeLevel + 1; i++) { spawnedProjectile = PoolingManager.Spawn(projectileToUse, transform.position + position); spawnedProjectile.GetComponent <Projectile>().Initialize(new Vector3(Mathf.Cos(anglePerUpgradeLevel * i), Mathf.Sin(anglePerUpgradeLevel * i))); spawnedProjectile = PoolingManager.Spawn(projectileToUse, transform.position + position); spawnedProjectile.GetComponent <Projectile>().Initialize(new Vector3(-Mathf.Cos(anglePerUpgradeLevel * i), Mathf.Sin(anglePerUpgradeLevel * i))); projectileToUse = upgradedProjectileTier2; } }
public override void Spawn() { PoolingManager.Spawn(enemyDifficultyEntry.prefab, new Vector3(Random.Range(-ScreenBoundary.screenBoundary.x, ScreenBoundary.screenBoundary.x), Random.Range(5f, 9.7f)), EnemyHolder.self.transform); }