コード例 #1
0
 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> ();
 }
コード例 #2
0
    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);
        }
    }
コード例 #3
0
    //float standartYCameraRotationLimit;

    void Start()
    {
        turretRotation = GetComponent <TurretRotation>();
    }
コード例 #4
0
ファイル: LauncherShooting.cs プロジェクト: wchoujaa/RTS
 private void Start()
 {
     unitController = GetComponent <UnitController>();
     turretRotation = GetComponentInChildren <TurretRotation>();
 }