Feel  3.16
The best way to improve your game's feel and make it extra juicy
MoreMountains.Feedbacks.MMFloatingTextSpawner Class Reference

This class will let you pool, recycle and spawn floating texts, usually to show damage info. It requires as input a MMFloatingText object. More...

Inheritance diagram for MoreMountains.Feedbacks.MMFloatingTextSpawner:
MoreMountains.Tools.MMMonoBehaviour

Public Types

enum  PoolerModes { PoolerModes.Simple, PoolerModes.Multiple }
 whether to spawn a single prefab or one at random More...
 
enum  AlignmentModes { AlignmentModes.Fixed, AlignmentModes.MatchInitialDirection, AlignmentModes.MatchMovementDirection }
 whether the spawned text should have a fixed alignment, orient to match the initial spawn direction, or its movement curve More...
 

Public Member Functions

virtual void OnMMFloatingTextSpawnEvent (MMChannelData channelData, Vector3 spawnPosition, string value, Vector3 direction, float intensity, bool forceLifetime=false, float lifetime=1f, bool forceColor=false, Gradient animateColorGradient=null, bool useUnscaledTime=false)
 When we get a floating text event on this spawner's Channel, we spawn a new floating text More...
 

Public Attributes

MMChannelModes ChannelMode = MMChannelModes.Int
 
int Channel = 0
 the channel to listen to - has to match the one on the feedback More...
 
MMChannel MMChannelDefinition = null
 
bool CanSpawn = true
 whether or not this spawner can spawn at this time More...
 
bool UseUnscaledTime = false
 whether or not this spawner should spawn objects on unscaled time More...
 
PoolerModes PoolerMode = PoolerModes.Simple
 the selected pooler mode (single prefab or multiple ones) More...
 
MMFloatingText PooledSimpleMMFloatingText
 the prefab to spawn (ignored if in multiple mode) More...
 
List< MMFloatingTextPooledMultipleMMFloatingText
 the prefabs to spawn (ignored if in simple mode) More...
 
int PoolSize = 20
 the amount of objects to pool to avoid having to instantiate them at runtime. Should be bigger than the max amount of texts you plan on having on screen at any given moment More...
 
bool NestWaitingPool = true
 whether or not to nest the waiting pools More...
 
bool MutualizeWaitingPools = true
 whether or not to mutualize the waiting pools More...
 
bool PoolCanExpand = true
 whether or not the text pool can expand if the pool is empty More...
 
Vector2 Lifetime = Vector2.one
 the random min and max lifetime duration for the spawned texts (in seconds) More...
 
Vector3 SpawnOffsetMin = Vector3.zero
 the random min position at which to spawn the text, relative to its intended spawn position More...
 
Vector3 SpawnOffsetMax = Vector3.zero
 the random max position at which to spawn the text, relative to its intended spawn position More...
 
bool AnimateMovement = true
 whether or not to animate the movement of spawned texts More...
 
bool AnimateX = false
 whether or not to animate the X movement of spawned texts More...
 
Vector2 RemapXZero = Vector2.zero
 the value to which the x movement curve's zero should be remapped to More...
 
Vector2 RemapXOne = Vector2.one
 the value to which the x movement curve's one should be remapped to More...
 
AnimationCurve AnimateXCurve = new AnimationCurve(new Keyframe(0f, 0f), new Keyframe(1f, 1f))
 the curve on which to animate the x movement More...
 
bool AnimateY = true
 whether or not to animate the Y movement of spawned texts More...
 
Vector2 RemapYZero = Vector2.zero
 the value to which the y movement curve's zero should be remapped to More...
 
Vector2 RemapYOne = new Vector2(5f, 5f)
 the value to which the y movement curve's one should be remapped to More...
 
AnimationCurve AnimateYCurve = new AnimationCurve(new Keyframe(0f, 0f), new Keyframe(1f, 1f))
 the curve on which to animate the y movement More...
 
bool AnimateZ = false
 whether or not to animate the Z movement of spawned texts More...
 
Vector2 RemapZZero = Vector2.zero
 the value to which the z movement curve's zero should be remapped to More...
 
Vector2 RemapZOne = Vector2.one
 the value to which the z movement curve's one should be remapped to More...
 
AnimationCurve AnimateZCurve = new AnimationCurve(new Keyframe(0f, 0f), new Keyframe(1f, 1f))
 the curve on which to animate the z movement More...
 
AlignmentModes AlignmentMode = AlignmentModes.Fixed
 the selected alignment mode (whether the spawned text should have a fixed alignment, orient to match the initial spawn direction, or its movement curve) More...
 
Vector3 FixedAlignment = Vector3.up
 when in fixed mode, the direction in which to keep the spawned texts More...
 
bool AlwaysFaceCamera
 whether or not spawned texts should always face the camera More...
 
bool AutoGrabMainCameraOnStart = true
 whether or not this spawner should automatically grab the main camera on start More...
 
Camera TargetCamera
 if not in auto grab mode, the camera to use for billboards More...
 
bool AnimateScale = true
 whether or not to animate the scale of spawned texts More...
 
Vector2 RemapScaleZero = Vector2.zero
 the value to which the scale curve's zero should be remapped to More...
 
Vector2 RemapScaleOne = Vector2.one
 the value to which the scale curve's one should be remapped to More...
 
AnimationCurve AnimateScaleCurve = new AnimationCurve(new Keyframe(0f, 0f), new Keyframe(0.15f, 1f), new Keyframe(0.85f, 1f), new Keyframe(1f, 0f))
 the curve on which to animate the scale More...
 
bool AnimateColor = false
 whether or not to animate the spawned text's color over time More...
 
Gradient AnimateColorGradient = new Gradient()
 the gradient over which to animate the spawned text's color over time More...
 
bool AnimateOpacity = true
 whether or not to animate the opacity of the spawned texts More...
 
Vector2 RemapOpacityZero = Vector2.zero
 the value to which the opacity curve's zero should be remapped to More...
 
Vector2 RemapOpacityOne = Vector2.one
 the value to which the opacity curve's one should be remapped to More...
 
AnimationCurve AnimateOpacityCurve = new AnimationCurve(new Keyframe(0f, 0f), new Keyframe(0.2f, 1f), new Keyframe(0.8f, 1f), new Keyframe(1f, 0f))
 the curve on which to animate the opacity More...
 
bool IntensityImpactsLifetime = false
 whether or not the intensity multiplier should impact lifetime More...
 
float IntensityLifetimeMultiplier = 1f
 when getting an intensity multiplier, the value by which to multiply the lifetime More...
 
bool IntensityImpactsMovement = false
 whether or not the intensity multiplier should impact movement More...
 
float IntensityMovementMultiplier = 1f
 when getting an intensity multiplier, the value by which to multiply the movement values More...
 
bool IntensityImpactsScale = false
 whether or not the intensity multiplier should impact scale More...
 
float IntensityScaleMultiplier = 1f
 when getting an intensity multiplier, the value by which to multiply the scale values More...
 
Vector2Int DebugRandomValue = new Vector2Int(100, 500)
 a random value to display when pressing the TestSpawnOne button More...
 
Vector2 DebugInterval = new Vector2(0.3f, 0.5f)
 the min and max bounds within which to pick a value to output when pressing the TestSpawnMany button More...
 
bool TestSpawnOneBtn
 a button used to test the spawn of one text More...
 
bool TestSpawnManyBtn
 a button used to start/stop the spawn of texts at regular intervals More...
 

Protected Member Functions

virtual void Start ()
 On awake we initialize our spawner More...
 
virtual void Initialization ()
 On init, we instantiate our object pool and grab the main camera More...
 
virtual void InstantiateObjectPool ()
 Instantiates the specified type of object pool More...
 
virtual void InstantiateSimplePool ()
 Instantiates a simple object pooler and sets it up More...
 
virtual void InstantiateMultiplePool ()
 Instantiates a multiple object pooler and sets it up More...
 
virtual void GrabMainCamera ()
 Grabs the main camera if needed More...
 
virtual void Spawn (string value, Vector3 position, Vector3 direction, float intensity=1f, bool forceLifetime=false, float lifetime=1f, bool forceColor=false, Gradient animateColorGradient=null)
 Spawns a new floating text More...
 
virtual void OnEnable ()
 On enable we start listening for floating text events More...
 
virtual void OnDisable ()
 On disable we stop listening for floating text events More...
 
virtual void TestSpawnOne ()
 A test method that spawns one floating text More...
 
virtual void TestSpawnMany ()
 A method used to start/stop the regular spawning of debug floating texts More...
 
virtual IEnumerator TestSpawnManyCo ()
 A coroutine used to spawn debug floating texts until stopped More...
 

Protected Attributes

MMObjectPooler _pooler
 
MMFloatingText _floatingText
 
Coroutine _testSpawnCoroutine
 
float _lifetime
 
float _speed
 
Vector3 _spawnOffset
 
Vector3 _direction
 
Gradient _colorGradient
 
bool _animateColor
 

Detailed Description

This class will let you pool, recycle and spawn floating texts, usually to show damage info. It requires as input a MMFloatingText object.

Member Enumeration Documentation

◆ AlignmentModes

whether the spawned text should have a fixed alignment, orient to match the initial spawn direction, or its movement curve

Enumerator
Fixed 
MatchInitialDirection 
MatchMovementDirection 

◆ PoolerModes

whether to spawn a single prefab or one at random

Enumerator
Simple 
Multiple 

Member Function Documentation

◆ GrabMainCamera()

virtual void MoreMountains.Feedbacks.MMFloatingTextSpawner.GrabMainCamera ( )
protectedvirtual

Grabs the main camera if needed

◆ Initialization()

virtual void MoreMountains.Feedbacks.MMFloatingTextSpawner.Initialization ( )
protectedvirtual

On init, we instantiate our object pool and grab the main camera

◆ InstantiateMultiplePool()

virtual void MoreMountains.Feedbacks.MMFloatingTextSpawner.InstantiateMultiplePool ( )
protectedvirtual

Instantiates a multiple object pooler and sets it up

◆ InstantiateObjectPool()

virtual void MoreMountains.Feedbacks.MMFloatingTextSpawner.InstantiateObjectPool ( )
protectedvirtual

Instantiates the specified type of object pool

◆ InstantiateSimplePool()

virtual void MoreMountains.Feedbacks.MMFloatingTextSpawner.InstantiateSimplePool ( )
protectedvirtual

Instantiates a simple object pooler and sets it up

◆ OnDisable()

virtual void MoreMountains.Feedbacks.MMFloatingTextSpawner.OnDisable ( )
protectedvirtual

On disable we stop listening for floating text events

◆ OnEnable()

virtual void MoreMountains.Feedbacks.MMFloatingTextSpawner.OnEnable ( )
protectedvirtual

On enable we start listening for floating text events

◆ OnMMFloatingTextSpawnEvent()

virtual void MoreMountains.Feedbacks.MMFloatingTextSpawner.OnMMFloatingTextSpawnEvent ( MMChannelData  channelData,
Vector3  spawnPosition,
string  value,
Vector3  direction,
float  intensity,
bool  forceLifetime = false,
float  lifetime = 1f,
bool  forceColor = false,
Gradient  animateColorGradient = null,
bool  useUnscaledTime = false 
)
virtual

When we get a floating text event on this spawner's Channel, we spawn a new floating text

Parameters
channel
spawnPosition
value
direction
intensity
forceLifetime
lifetime
forceColor
animateColorGradient

◆ Spawn()

virtual void MoreMountains.Feedbacks.MMFloatingTextSpawner.Spawn ( string  value,
Vector3  position,
Vector3  direction,
float  intensity = 1f,
bool  forceLifetime = false,
float  lifetime = 1f,
bool  forceColor = false,
Gradient  animateColorGradient = null 
)
protectedvirtual

Spawns a new floating text

Parameters
value
position
direction
intensity
forceLifetime
lifetime
forceColor
animateColorGradient

◆ Start()

virtual void MoreMountains.Feedbacks.MMFloatingTextSpawner.Start ( )
protectedvirtual

On awake we initialize our spawner

◆ TestSpawnMany()

virtual void MoreMountains.Feedbacks.MMFloatingTextSpawner.TestSpawnMany ( )
protectedvirtual

A method used to start/stop the regular spawning of debug floating texts

◆ TestSpawnManyCo()

virtual IEnumerator MoreMountains.Feedbacks.MMFloatingTextSpawner.TestSpawnManyCo ( )
protectedvirtual

A coroutine used to spawn debug floating texts until stopped

Returns

◆ TestSpawnOne()

virtual void MoreMountains.Feedbacks.MMFloatingTextSpawner.TestSpawnOne ( )
protectedvirtual

A test method that spawns one floating text

Member Data Documentation

◆ _animateColor

bool MoreMountains.Feedbacks.MMFloatingTextSpawner._animateColor
protected

◆ _colorGradient

Gradient MoreMountains.Feedbacks.MMFloatingTextSpawner._colorGradient
protected

◆ _direction

Vector3 MoreMountains.Feedbacks.MMFloatingTextSpawner._direction
protected

◆ _floatingText

MMFloatingText MoreMountains.Feedbacks.MMFloatingTextSpawner._floatingText
protected

◆ _lifetime

float MoreMountains.Feedbacks.MMFloatingTextSpawner._lifetime
protected

◆ _pooler

MMObjectPooler MoreMountains.Feedbacks.MMFloatingTextSpawner._pooler
protected

◆ _spawnOffset

Vector3 MoreMountains.Feedbacks.MMFloatingTextSpawner._spawnOffset
protected

◆ _speed

float MoreMountains.Feedbacks.MMFloatingTextSpawner._speed
protected

◆ _testSpawnCoroutine

Coroutine MoreMountains.Feedbacks.MMFloatingTextSpawner._testSpawnCoroutine
protected

◆ AlignmentMode

AlignmentModes MoreMountains.Feedbacks.MMFloatingTextSpawner.AlignmentMode = AlignmentModes.Fixed

the selected alignment mode (whether the spawned text should have a fixed alignment, orient to match the initial spawn direction, or its movement curve)

◆ AlwaysFaceCamera

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.AlwaysFaceCamera

whether or not spawned texts should always face the camera

◆ AnimateColor

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.AnimateColor = false

whether or not to animate the spawned text's color over time

◆ AnimateColorGradient

Gradient MoreMountains.Feedbacks.MMFloatingTextSpawner.AnimateColorGradient = new Gradient()

the gradient over which to animate the spawned text's color over time

◆ AnimateMovement

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.AnimateMovement = true

whether or not to animate the movement of spawned texts

◆ AnimateOpacity

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.AnimateOpacity = true

whether or not to animate the opacity of the spawned texts

◆ AnimateOpacityCurve

AnimationCurve MoreMountains.Feedbacks.MMFloatingTextSpawner.AnimateOpacityCurve = new AnimationCurve(new Keyframe(0f, 0f), new Keyframe(0.2f, 1f), new Keyframe(0.8f, 1f), new Keyframe(1f, 0f))

the curve on which to animate the opacity

◆ AnimateScale

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.AnimateScale = true

whether or not to animate the scale of spawned texts

◆ AnimateScaleCurve

AnimationCurve MoreMountains.Feedbacks.MMFloatingTextSpawner.AnimateScaleCurve = new AnimationCurve(new Keyframe(0f, 0f), new Keyframe(0.15f, 1f), new Keyframe(0.85f, 1f), new Keyframe(1f, 0f))

the curve on which to animate the scale

◆ AnimateX

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.AnimateX = false

whether or not to animate the X movement of spawned texts

◆ AnimateXCurve

AnimationCurve MoreMountains.Feedbacks.MMFloatingTextSpawner.AnimateXCurve = new AnimationCurve(new Keyframe(0f, 0f), new Keyframe(1f, 1f))

the curve on which to animate the x movement

◆ AnimateY

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.AnimateY = true

whether or not to animate the Y movement of spawned texts

◆ AnimateYCurve

AnimationCurve MoreMountains.Feedbacks.MMFloatingTextSpawner.AnimateYCurve = new AnimationCurve(new Keyframe(0f, 0f), new Keyframe(1f, 1f))

the curve on which to animate the y movement

◆ AnimateZ

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.AnimateZ = false

whether or not to animate the Z movement of spawned texts

◆ AnimateZCurve

AnimationCurve MoreMountains.Feedbacks.MMFloatingTextSpawner.AnimateZCurve = new AnimationCurve(new Keyframe(0f, 0f), new Keyframe(1f, 1f))

the curve on which to animate the z movement

◆ AutoGrabMainCameraOnStart

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.AutoGrabMainCameraOnStart = true

whether or not this spawner should automatically grab the main camera on start

◆ CanSpawn

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.CanSpawn = true

whether or not this spawner can spawn at this time

◆ Channel

int MoreMountains.Feedbacks.MMFloatingTextSpawner.Channel = 0

the channel to listen to - has to match the one on the feedback

◆ ChannelMode

MMChannelModes MoreMountains.Feedbacks.MMFloatingTextSpawner.ChannelMode = MMChannelModes.Int

whether to listen on a channel defined by an int or by a MMChannel scriptable object. Ints are simple to setup but can get messy and make it harder to remember what int corresponds to what. MMChannel scriptable objects require you to create them in advance, but come with a readable name and are more scalable

◆ DebugInterval

Vector2 MoreMountains.Feedbacks.MMFloatingTextSpawner.DebugInterval = new Vector2(0.3f, 0.5f)

the min and max bounds within which to pick a value to output when pressing the TestSpawnMany button

◆ DebugRandomValue

Vector2Int MoreMountains.Feedbacks.MMFloatingTextSpawner.DebugRandomValue = new Vector2Int(100, 500)

a random value to display when pressing the TestSpawnOne button

◆ FixedAlignment

Vector3 MoreMountains.Feedbacks.MMFloatingTextSpawner.FixedAlignment = Vector3.up

when in fixed mode, the direction in which to keep the spawned texts

◆ IntensityImpactsLifetime

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.IntensityImpactsLifetime = false

whether or not the intensity multiplier should impact lifetime

◆ IntensityImpactsMovement

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.IntensityImpactsMovement = false

whether or not the intensity multiplier should impact movement

◆ IntensityImpactsScale

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.IntensityImpactsScale = false

whether or not the intensity multiplier should impact scale

◆ IntensityLifetimeMultiplier

float MoreMountains.Feedbacks.MMFloatingTextSpawner.IntensityLifetimeMultiplier = 1f

when getting an intensity multiplier, the value by which to multiply the lifetime

◆ IntensityMovementMultiplier

float MoreMountains.Feedbacks.MMFloatingTextSpawner.IntensityMovementMultiplier = 1f

when getting an intensity multiplier, the value by which to multiply the movement values

◆ IntensityScaleMultiplier

float MoreMountains.Feedbacks.MMFloatingTextSpawner.IntensityScaleMultiplier = 1f

when getting an intensity multiplier, the value by which to multiply the scale values

◆ Lifetime

Vector2 MoreMountains.Feedbacks.MMFloatingTextSpawner.Lifetime = Vector2.one

the random min and max lifetime duration for the spawned texts (in seconds)

◆ MMChannelDefinition

MMChannel MoreMountains.Feedbacks.MMFloatingTextSpawner.MMChannelDefinition = null

the MMChannel definition asset to use to listen for events. The feedbacks targeting this shaker will have to reference that same MMChannel definition to receive events - to create a MMChannel, right click anywhere in your project (usually in a Data folder) and go MoreMountains > MMChannel, then name it with some unique name

◆ MutualizeWaitingPools

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.MutualizeWaitingPools = true

whether or not to mutualize the waiting pools

◆ NestWaitingPool

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.NestWaitingPool = true

whether or not to nest the waiting pools

◆ PoolCanExpand

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.PoolCanExpand = true

whether or not the text pool can expand if the pool is empty

◆ PooledMultipleMMFloatingText

List<MMFloatingText> MoreMountains.Feedbacks.MMFloatingTextSpawner.PooledMultipleMMFloatingText

the prefabs to spawn (ignored if in simple mode)

◆ PooledSimpleMMFloatingText

MMFloatingText MoreMountains.Feedbacks.MMFloatingTextSpawner.PooledSimpleMMFloatingText

the prefab to spawn (ignored if in multiple mode)

◆ PoolerMode

PoolerModes MoreMountains.Feedbacks.MMFloatingTextSpawner.PoolerMode = PoolerModes.Simple

the selected pooler mode (single prefab or multiple ones)

◆ PoolSize

int MoreMountains.Feedbacks.MMFloatingTextSpawner.PoolSize = 20

the amount of objects to pool to avoid having to instantiate them at runtime. Should be bigger than the max amount of texts you plan on having on screen at any given moment

◆ RemapOpacityOne

Vector2 MoreMountains.Feedbacks.MMFloatingTextSpawner.RemapOpacityOne = Vector2.one

the value to which the opacity curve's one should be remapped to

◆ RemapOpacityZero

Vector2 MoreMountains.Feedbacks.MMFloatingTextSpawner.RemapOpacityZero = Vector2.zero

the value to which the opacity curve's zero should be remapped to

◆ RemapScaleOne

Vector2 MoreMountains.Feedbacks.MMFloatingTextSpawner.RemapScaleOne = Vector2.one

the value to which the scale curve's one should be remapped to

◆ RemapScaleZero

Vector2 MoreMountains.Feedbacks.MMFloatingTextSpawner.RemapScaleZero = Vector2.zero

the value to which the scale curve's zero should be remapped to

◆ RemapXOne

Vector2 MoreMountains.Feedbacks.MMFloatingTextSpawner.RemapXOne = Vector2.one

the value to which the x movement curve's one should be remapped to

◆ RemapXZero

Vector2 MoreMountains.Feedbacks.MMFloatingTextSpawner.RemapXZero = Vector2.zero

the value to which the x movement curve's zero should be remapped to

◆ RemapYOne

Vector2 MoreMountains.Feedbacks.MMFloatingTextSpawner.RemapYOne = new Vector2(5f, 5f)

the value to which the y movement curve's one should be remapped to

◆ RemapYZero

Vector2 MoreMountains.Feedbacks.MMFloatingTextSpawner.RemapYZero = Vector2.zero

the value to which the y movement curve's zero should be remapped to

◆ RemapZOne

Vector2 MoreMountains.Feedbacks.MMFloatingTextSpawner.RemapZOne = Vector2.one

the value to which the z movement curve's one should be remapped to

◆ RemapZZero

Vector2 MoreMountains.Feedbacks.MMFloatingTextSpawner.RemapZZero = Vector2.zero

the value to which the z movement curve's zero should be remapped to

◆ SpawnOffsetMax

Vector3 MoreMountains.Feedbacks.MMFloatingTextSpawner.SpawnOffsetMax = Vector3.zero

the random max position at which to spawn the text, relative to its intended spawn position

◆ SpawnOffsetMin

Vector3 MoreMountains.Feedbacks.MMFloatingTextSpawner.SpawnOffsetMin = Vector3.zero

the random min position at which to spawn the text, relative to its intended spawn position

◆ TargetCamera

Camera MoreMountains.Feedbacks.MMFloatingTextSpawner.TargetCamera

if not in auto grab mode, the camera to use for billboards

◆ TestSpawnManyBtn

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.TestSpawnManyBtn

a button used to start/stop the spawn of texts at regular intervals

◆ TestSpawnOneBtn

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.TestSpawnOneBtn

a button used to test the spawn of one text

◆ UseUnscaledTime

bool MoreMountains.Feedbacks.MMFloatingTextSpawner.UseUnscaledTime = false

whether or not this spawner should spawn objects on unscaled time


The documentation for this class was generated from the following file: