Next: , Previous: , Up: AI   [Contents][Index]


2.8 Turret Action

Component: TurretAction

This component goes on a turret. We recommend creating an empty object, attaching this component, then parenting a 3D model of a turretto it. This essentially is an object spawner with special effects. Though it’s designed to be used with the Bullet component (under ’Combat’) it could be used with other things as well (like homing missiles, or basket balls)

Required Field of TurretAction: GameObject muzzleTransform

An object representing the exit point of the projectiles. Z direction is forward

Required Field of TurretAction: float delay

How often does a bullet leave the muzzle?

Default value: 0.25f

Field of TurretAction: bool requireTarget

If false, we’ll just fire even if we don’t have a target

Default value: true

Required Field of TurretAction: GameObject projectile

What are we shooting out?

Required Field of TurretAction: float flashDuration

How long should that object be alive?

Default value: 0.0125f

Cosmetics

Optional Field of TurretAction: string mecanimFireTrigger

A trigger to be played on any attached Animator, if any, when the turret fires.

Default value: ""

Optional Field of TurretAction: GameObject muzzleFlash

Should we spawn an object each time we fire?

Recommended Field of TurretAction: AudioClip fireSound

Sound to play when firing

Optional Field of TurretAction: AudioClip targetAcquired

Sound to play on target acquisition

Optional Field of TurretAction: AudioClip targetLost

Sound to play when target leaves range

Available Messages

Message on TurretAction: ClearTarget ()

Clears the turret action’s target, causing it to stop firing. It will still cease firing if it’s not requiring targets.

Message on TurretAction: BeginFiring ()

Causes the turret to begin firing in a loop, even when it’s set not to require targets.

Message on TurretAction: Fire ()

Fires this turret immediately.

Required Field of TurretAction: GameObject muzzleTransform

An object representing the exit point of the projectiles. Z direction is forward

Required Field of TurretAction: float delay

How often does a bullet leave the muzzle?

Default value: 0.25f

Field of TurretAction: bool requireTarget

If false, we’ll just fire even if we don’t have a target

Default value: true

Required Field of TurretAction: GameObject projectile

What are we shooting out?

Required Field of TurretAction: float flashDuration

How long should that object be alive?

Default value: 0.0125f

Cosmetics

Optional Field of TurretAction: string mecanimFireTrigger

A trigger to be played on any attached Animator, if any, when the turret fires.

Default value: ""

Optional Field of TurretAction: GameObject muzzleFlash

Should we spawn an object each time we fire?

Recommended Field of TurretAction: AudioClip fireSound

Sound to play when firing

Optional Field of TurretAction: AudioClip targetAcquired

Sound to play on target acquisition

Optional Field of TurretAction: AudioClip targetLost

Sound to play when target leaves range

Available Messages

Message on TurretAction: ClearTarget ()

Clears the turret action’s target, causing it to stop firing. It will still cease firing if it’s not requiring targets.

Message on TurretAction: BeginFiring ()

Causes the turret to begin firing in a loop, even when it’s set not to require targets.

Message on TurretAction: Fire ()

Fires this turret immediately.


Next: , Previous: , Up: AI   [Contents][Index]