Adventure Creator 1.85.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2025
Loading...
Searching...
No Matches
AC.FootstepSounds Class Reference
Inheritance diagram for AC.FootstepSounds:

Public Types

enum  FootstepPlayMethod { Automatically , ViaAnimationEvents }

Public Member Functions

void PlayFootstep (AnimationEvent animationEvent)
void PlayFootstep ()
void RecordOriginalRelativeSound ()

Public Attributes

Sound soundToPlayFrom
FootstepPlayMethod footstepPlayMethod = FootstepPlayMethod.ViaAnimationEvents
Char character
bool doGroundedCheck = false
bool doMovementCheck = true
bool autoDetectSurface = true
float raycastLength = 0.5f
LayerMask layerMask = new LayerMask ()
float pitchVariance = 0f
float volumeVariance = 0f
float walkSeparationTime = 0.5f
float runSeparationTime = 0.25f

Protected Member Functions

void OnValidate ()
void Awake ()
void Update ()
void RequestSurface ()
void ProcessCollider (Collider collider)
void ProcessCollider (Collider2D collider)
void ProcessName (string name)
void PlaySound (AudioClip[] clips, bool isRunSound)
void PlaySound (AudioClip clip, bool isRunSound)
bool IsHeaviestAnimClip (AnimationClip currentClip)

Protected Attributes

float originalRelativeSound = 1f
int lastIndex
AudioSource audioSource
float delayTime

Properties

Surface CurrentSurface [get, set]

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() [1/2]

void AC.FootstepSounds.PlayFootstep ( )

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

◆ PlayFootstep() [2/2]

void AC.FootstepSounds.PlayFootstep ( AnimationEvent animationEvent)

Triggered by PlayFootstep animation events

◆ RecordOriginalRelativeSound()

void AC.FootstepSounds.RecordOriginalRelativeSound ( )

Records the associated Sound component's relative volume.

Member Data Documentation

◆ autoDetectSurface

bool AC.FootstepSounds.autoDetectSurface = true

If True, then raycasting will be used to auto-detect the current Surface

◆ 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

◆ 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

◆ 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

Property Documentation

◆ CurrentSurface

Surface AC.FootstepSounds.CurrentSurface
getset

The current surface to get sounds from