void Awake() { //getting all the components on the object. Setting them before RUN state will be a better approach _Rotation = this.GetComponent <TurretRotation> (); _Raycast = this.GetComponent <RaycastHandler> (); _Shooting = this.GetComponent <ShootingSystem> (); _Health = this.GetComponent <TurretHealth> (); _Audio = this.GetComponent <AudioHandler> (); }
private void Shoot(BaseObject enemy) { TurretRotation tr = GetComponent <TurretRotation>(); if ((tr == null || (tr != null && tr.IsRotationFinished())) && Time.time > fireRate + lastShotTimestamp) { lastShotTimestamp = Time.time; GameObject spawned = Instantiate(this.bulletPrefab, projectilePosition.transform.position, projectilePosition.transform.rotation); GameObject explosion = Instantiate(this.explosionPrefab, projectilePosition.transform.position, projectilePosition.transform.rotation); spawned.GetComponent <Bullet>().Setup(enemy); } }
//float standartYCameraRotationLimit; void Start() { turretRotation = GetComponent <TurretRotation>(); }
private void Start() { unitController = GetComponent <UnitController>(); turretRotation = GetComponentInChildren <TurretRotation>(); }