private CardDisplay GetDisplay(Transform parent) { Vector3 position = parent.position; position.x += parent.childCount * 1.5f; CardDisplay display = _poolingSystem.Dequeue(parent, position, parent.rotation); return(display); }
public void Shoot(Vector3 position, Quaternion rotation) { if (Time.time > _nextFire) { _nextFire = Time.time + _fireRate; GameObject obj = _poolingSystem.Dequeue(_bulletTag, position, rotation); var bullet = obj.GetComponent <TurretBullet>(); if (bullet) { _audioManager.PlayEnemyShotClip(); bullet.OnAfterHit += OnAfterHit; } } }
private void Shooting() { if (!_isShooting && (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Space)) && _targetIndex != -1) { _isShooting = true; GameObject obj = _poolingSystem.Dequeue(_missileTag, _cannon.position, _cannon.rotation); var missile = obj.GetComponent <PlayerMissile>(); if (missile) { _audioManager.PlayPlayerShotClip(); _targetToDestroy = _visibleTargets[_targetIndex]; missile.Target = _targetToDestroy.Target; missile.OnAfterHit += OnAfterShoot; } } }