Highroad Engine v1.3
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
MoreMountains.Tools.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.Tools.MMFloatingTextSpawner:
MoreMountains.Tools.MMMonoBehaviour

Public Types

enum  PoolerModes { Simple , Multiple }
 whether to spawn a single prefab or one at random More...
 
enum  AlignmentModes { Fixed , MatchInitialDirection , 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 (int channel, 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

int Channel = 0
 the channel to listen for events on. this will have to be matched in the feedbacks trying to command this spawner More...
 
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.Tools.MMFloatingTextSpawner.GrabMainCamera ( )
protectedvirtual

Grabs the main camera if needed

◆ Initialization()

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

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

◆ InstantiateMultiplePool()

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

Instantiates a multiple object pooler and sets it up

◆ InstantiateObjectPool()

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

Instantiates the specified type of object pool

◆ InstantiateSimplePool()

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

Instantiates a simple object pooler and sets it up

◆ OnDisable()

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

On disable we stop listening for floating text events

◆ OnEnable()

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

On enable we start listening for floating text events

◆ OnMMFloatingTextSpawnEvent()

virtual void MoreMountains.Tools.MMFloatingTextSpawner.OnMMFloatingTextSpawnEvent ( int  channel,
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.Tools.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.Tools.MMFloatingTextSpawner.Start ( )
protectedvirtual

On awake we initialize our spawner

◆ TestSpawnMany()

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

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

◆ TestSpawnManyCo()

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

A coroutine used to spawn debug floating texts until stopped

Returns

◆ TestSpawnOne()

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

A test method that spawns one floating text

Member Data Documentation

◆ _animateColor

bool MoreMountains.Tools.MMFloatingTextSpawner._animateColor
protected

◆ _colorGradient

Gradient MoreMountains.Tools.MMFloatingTextSpawner._colorGradient
protected

◆ _direction

Vector3 MoreMountains.Tools.MMFloatingTextSpawner._direction
protected

◆ _floatingText

MMFloatingText MoreMountains.Tools.MMFloatingTextSpawner._floatingText
protected

◆ _lifetime

float MoreMountains.Tools.MMFloatingTextSpawner._lifetime
protected

◆ _pooler

MMObjectPooler MoreMountains.Tools.MMFloatingTextSpawner._pooler
protected

◆ _spawnOffset

Vector3 MoreMountains.Tools.MMFloatingTextSpawner._spawnOffset
protected

◆ _speed

float MoreMountains.Tools.MMFloatingTextSpawner._speed
protected

◆ _testSpawnCoroutine

Coroutine MoreMountains.Tools.MMFloatingTextSpawner._testSpawnCoroutine
protected

◆ AlignmentMode

AlignmentModes MoreMountains.Tools.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.Tools.MMFloatingTextSpawner.AlwaysFaceCamera

whether or not spawned texts should always face the camera

◆ AnimateColor

bool MoreMountains.Tools.MMFloatingTextSpawner.AnimateColor = false

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

◆ AnimateColorGradient

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

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

◆ AnimateMovement

bool MoreMountains.Tools.MMFloatingTextSpawner.AnimateMovement = true

whether or not to animate the movement of spawned texts

◆ AnimateOpacity

bool MoreMountains.Tools.MMFloatingTextSpawner.AnimateOpacity = true

whether or not to animate the opacity of the spawned texts

◆ AnimateOpacityCurve

AnimationCurve MoreMountains.Tools.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.Tools.MMFloatingTextSpawner.AnimateScale = true

whether or not to animate the scale of spawned texts

◆ AnimateScaleCurve

AnimationCurve MoreMountains.Tools.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.Tools.MMFloatingTextSpawner.AnimateX = false

whether or not to animate the X movement of spawned texts

◆ AnimateXCurve

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

the curve on which to animate the x movement

◆ AnimateY

bool MoreMountains.Tools.MMFloatingTextSpawner.AnimateY = true

whether or not to animate the Y movement of spawned texts

◆ AnimateYCurve

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

the curve on which to animate the y movement

◆ AnimateZ

bool MoreMountains.Tools.MMFloatingTextSpawner.AnimateZ = false

whether or not to animate the Z movement of spawned texts

◆ AnimateZCurve

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

the curve on which to animate the z movement

◆ AutoGrabMainCameraOnStart

bool MoreMountains.Tools.MMFloatingTextSpawner.AutoGrabMainCameraOnStart = true

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

◆ CanSpawn

bool MoreMountains.Tools.MMFloatingTextSpawner.CanSpawn = true

whether or not this spawner can spawn at this time

◆ Channel

int MoreMountains.Tools.MMFloatingTextSpawner.Channel = 0

the channel to listen for events on. this will have to be matched in the feedbacks trying to command this spawner

◆ DebugInterval

Vector2 MoreMountains.Tools.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.Tools.MMFloatingTextSpawner.DebugRandomValue = new Vector2Int(100, 500)

a random value to display when pressing the TestSpawnOne button

◆ FixedAlignment

Vector3 MoreMountains.Tools.MMFloatingTextSpawner.FixedAlignment = Vector3.up

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

◆ IntensityImpactsLifetime

bool MoreMountains.Tools.MMFloatingTextSpawner.IntensityImpactsLifetime = false

whether or not the intensity multiplier should impact lifetime

◆ IntensityImpactsMovement

bool MoreMountains.Tools.MMFloatingTextSpawner.IntensityImpactsMovement = false

whether or not the intensity multiplier should impact movement

◆ IntensityImpactsScale

bool MoreMountains.Tools.MMFloatingTextSpawner.IntensityImpactsScale = false

whether or not the intensity multiplier should impact scale

◆ IntensityLifetimeMultiplier

float MoreMountains.Tools.MMFloatingTextSpawner.IntensityLifetimeMultiplier = 1f

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

◆ IntensityMovementMultiplier

float MoreMountains.Tools.MMFloatingTextSpawner.IntensityMovementMultiplier = 1f

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

◆ IntensityScaleMultiplier

float MoreMountains.Tools.MMFloatingTextSpawner.IntensityScaleMultiplier = 1f

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

◆ Lifetime

Vector2 MoreMountains.Tools.MMFloatingTextSpawner.Lifetime = Vector2.one

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

◆ MutualizeWaitingPools

bool MoreMountains.Tools.MMFloatingTextSpawner.MutualizeWaitingPools = true

whether or not to mutualize the waiting pools

◆ NestWaitingPool

bool MoreMountains.Tools.MMFloatingTextSpawner.NestWaitingPool = true

whether or not to nest the waiting pools

◆ PoolCanExpand

bool MoreMountains.Tools.MMFloatingTextSpawner.PoolCanExpand = true

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

◆ PooledMultipleMMFloatingText

List<MMFloatingText> MoreMountains.Tools.MMFloatingTextSpawner.PooledMultipleMMFloatingText

the prefabs to spawn (ignored if in simple mode)

◆ PooledSimpleMMFloatingText

MMFloatingText MoreMountains.Tools.MMFloatingTextSpawner.PooledSimpleMMFloatingText

the prefab to spawn (ignored if in multiple mode)

◆ PoolerMode

PoolerModes MoreMountains.Tools.MMFloatingTextSpawner.PoolerMode = PoolerModes.Simple

the selected pooler mode (single prefab or multiple ones)

◆ PoolSize

int MoreMountains.Tools.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.Tools.MMFloatingTextSpawner.RemapOpacityOne = Vector2.one

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

◆ RemapOpacityZero

Vector2 MoreMountains.Tools.MMFloatingTextSpawner.RemapOpacityZero = Vector2.zero

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

◆ RemapScaleOne

Vector2 MoreMountains.Tools.MMFloatingTextSpawner.RemapScaleOne = Vector2.one

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

◆ RemapScaleZero

Vector2 MoreMountains.Tools.MMFloatingTextSpawner.RemapScaleZero = Vector2.zero

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

◆ RemapXOne

Vector2 MoreMountains.Tools.MMFloatingTextSpawner.RemapXOne = Vector2.one

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

◆ RemapXZero

Vector2 MoreMountains.Tools.MMFloatingTextSpawner.RemapXZero = Vector2.zero

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

◆ RemapYOne

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

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

◆ RemapYZero

Vector2 MoreMountains.Tools.MMFloatingTextSpawner.RemapYZero = Vector2.zero

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

◆ RemapZOne

Vector2 MoreMountains.Tools.MMFloatingTextSpawner.RemapZOne = Vector2.one

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

◆ RemapZZero

Vector2 MoreMountains.Tools.MMFloatingTextSpawner.RemapZZero = Vector2.zero

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

◆ SpawnOffsetMax

Vector3 MoreMountains.Tools.MMFloatingTextSpawner.SpawnOffsetMax = Vector3.zero

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

◆ SpawnOffsetMin

Vector3 MoreMountains.Tools.MMFloatingTextSpawner.SpawnOffsetMin = Vector3.zero

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

◆ TargetCamera

Camera MoreMountains.Tools.MMFloatingTextSpawner.TargetCamera

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

◆ TestSpawnManyBtn

bool MoreMountains.Tools.MMFloatingTextSpawner.TestSpawnManyBtn

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

◆ TestSpawnOneBtn

bool MoreMountains.Tools.MMFloatingTextSpawner.TestSpawnOneBtn

a button used to test the spawn of one text

◆ UseUnscaledTime

bool MoreMountains.Tools.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: