Adventure Creator  1.79.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
AC.FootstepSounds Class Reference
Inheritance diagram for AC.FootstepSounds:

Public Types

enum  FootstepPlayMethod { Automatically, ViaAnimationEvents }
 

Public Member Functions

void PlayFootstep ()
 
void RecordOriginalRelativeSound ()
 

Public Attributes

AudioClip[] footstepSounds
 
AudioClip[] runSounds
 
Sound soundToPlayFrom
 
FootstepPlayMethod footstepPlayMethod = FootstepPlayMethod.ViaAnimationEvents
 
Char character
 
bool doGroundedCheck = false
 
bool doMovementCheck = true
 
float pitchVariance = 0f
 
float volumeVariance = 0f
 
float walkSeparationTime = 0.5f
 
float runSeparationTime = 0.25f
 

Protected Member Functions

void Awake ()
 
void Update ()
 
void PlaySound (AudioClip[] clips, bool isRunSound)
 
void PlaySound (AudioClip clip, bool isRunSound)
 

Protected Attributes

float originalRelativeSound = 1f
 
int lastIndex
 
AudioSource audioSource
 
float delayTime
 

Detailed Description

A component that can play footstep sounds whenever a Mecanim-animated Character moves. The component stores an array of AudioClips, one of which is played at random whenever the PlayFootstep method is called. This method should be invoked as part of a Unity AnimationEvent: http://docs.unity3d.com/Manual/animeditor-AnimationEvents.html

Member Function Documentation

◆ PlayFootstep()

void AC.FootstepSounds.PlayFootstep ( )

Plays one of the footstepSounds at random on the assigned Sound object.

◆ RecordOriginalRelativeSound()

void AC.FootstepSounds.RecordOriginalRelativeSound ( )

Records the associated Sound component's relative volume.

Member Data Documentation

◆ character

Char AC.FootstepSounds.character

The Player or NPC that this component is for

◆ doGroundedCheck

bool AC.FootstepSounds.doGroundedCheck = false

If True, and character is assigned, sounds will only play when the character is grounded

◆ doMovementCheck

bool AC.FootstepSounds.doMovementCheck = true

If True, and character is assigned, sounds will only play when the character is moving

◆ footstepPlayMethod

FootstepPlayMethod AC.FootstepSounds.footstepPlayMethod = FootstepPlayMethod.ViaAnimationEvents

How the sounds are played

◆ footstepSounds

AudioClip [] AC.FootstepSounds.footstepSounds

An array of footstep AudioClips to play at random

◆ pitchVariance

float AC.FootstepSounds.pitchVariance = 0f

How much the audio pitch can randomly vary by

◆ runSeparationTime

float AC.FootstepSounds.runSeparationTime = 0.25f

The separation time between sounds when running

◆ runSounds

AudioClip [] AC.FootstepSounds.runSounds

An array of footstep AudioClips to play at random when running - if left blank, normal sounds will play

◆ soundToPlayFrom

Sound AC.FootstepSounds.soundToPlayFrom

The Sound object to play from

◆ volumeVariance

float AC.FootstepSounds.volumeVariance = 0f

How much the audio volume can randomly vary by

◆ walkSeparationTime

float AC.FootstepSounds.walkSeparationTime = 0.5f

The separation time between sounds when walking