TopDown Engine  v4.2
MoreMountains.Feedbacks.MMF_Flicker Class Reference

This feedback will make the bound renderer flicker for the set duration when played (and restore its initial color when stopped) More...

Inheritance diagram for MoreMountains.Feedbacks.MMF_Flicker:
MoreMountains.Feedbacks.MMF_Feedback

Public Types

enum  Modes { Modes.Color, Modes.PropertyName }
 

Public Member Functions

virtual IEnumerator Flicker (Renderer renderer, int materialIndex, Color initialColor, Color flickerColor, float flickerSpeed, float flickerDuration)
 

Public Attributes

override bool HasAutomatedTargetAcquisition => true
 sets the inspector color for this feedback More...
 
Renderer BoundRenderer
 the renderer to flicker when played More...
 
List< Renderer > ExtraBoundRenderers
 more renderers to flicker when played More...
 
Modes Mode = Modes.Color
 the selected mode to flicker the renderer More...
 
string PropertyName = "_Tint"
 the name of the property to target More...
 
float FlickerDuration = 0.2f
 the duration of the flicker when getting damage More...
 
float FlickerPeriod = 0.04f
 the duration of the period for the flicker More...
 
Color FlickerColor = new Color32(255, 20, 20, 255)
 the color we should flicker the sprite to More...
 
int[] MaterialIndexes
 the list of material indexes we want to flicker on the target renderer. If left empty, will only target the material at index 0 More...
 
bool UseMaterialPropertyBlocks = false
 if this is true, this component will use material property blocks instead of working on an instance of the material. More...
 
string SpriteRendererTextureProperty = "_MainTex"
 if using material property blocks on a sprite renderer, you'll want to make sure the sprite texture gets passed to the block when updating it. For that, you need to specify your sprite's material's shader's texture property name. If you're not working with a sprite renderer, you can safely ignore this. More...
 

Static Public Attributes

static bool FeedbackTypeAuthorized = true
 a static bool used to disable all feedbacks of this type at once More...
 

Protected Member Functions

override void AutomateTargetAcquisition ()
 A method meant to be implemented per feedback letting you specify what happens (usually setting a target) More...
 
override void CustomInitialization (MMF_Player owner)
 On init we grab our initial color and components More...
 
virtual void AcquireRenderers (MMF_Player owner)
 
virtual void StoreSpriteRendererTexture ()
 
override void CustomPlayFeedback (Vector3 position, float feedbacksIntensity=1.0f)
 On play we make our renderer flicker More...
 
override void CustomReset ()
 On reset we make our renderer stop flickering More...
 
virtual void SetStoredSpriteRendererTexture (Renderer renderer, MaterialPropertyBlock block)
 
virtual void SetColor (Renderer renderer, int materialIndex, Color color)
 
override void CustomStopFeedback (Vector3 position, float feedbacksIntensity=1)
 Stops this feedback More...
 
override void CustomRestoreInitialValues ()
 On restore, we put our object back at its initial position More...
 

Protected Attributes

int[] _propertyIDs
 
bool[] _propertiesFound
 
bool _spriteRendererIsNull
 
Coroutine[] _coroutines
 
List< Coroutine[]> _extraCoroutines
 
Color[] _initialFlickerColors
 
List< Color[]> _extraInitialFlickerColors
 
MaterialPropertyBlock _propertyBlock
 
List< MaterialPropertyBlock > _extraPropertyBlocks
 
SpriteRenderer _spriteRenderer
 
List< SpriteRenderer > _spriteRenderers
 
Texture2D _spriteRendererTexture
 
List< Texture2D > _spriteRendererTextures
 

Static Protected Attributes

const string _colorPropertyName = "_Color"
 

Properties

override float FeedbackDuration [get, set]
 the duration of this feedback is the duration of the flicker More...
 

Detailed Description

This feedback will make the bound renderer flicker for the set duration when played (and restore its initial color when stopped)

Member Enumeration Documentation

◆ Modes

the possible modes Color : will control material.color PropertyName : will target a specific shader property by name

Enumerator
Color 
PropertyName 

Member Function Documentation

◆ AcquireRenderers()

virtual void MoreMountains.Feedbacks.MMF_Flicker.AcquireRenderers ( MMF_Player  owner)
protectedvirtual

◆ AutomateTargetAcquisition()

override void MoreMountains.Feedbacks.MMF_Flicker.AutomateTargetAcquisition ( )
protectedvirtual

A method meant to be implemented per feedback letting you specify what happens (usually setting a target)

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ CustomInitialization()

override void MoreMountains.Feedbacks.MMF_Flicker.CustomInitialization ( MMF_Player  owner)
protectedvirtual

On init we grab our initial color and components

Parameters
owner

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ CustomPlayFeedback()

override void MoreMountains.Feedbacks.MMF_Flicker.CustomPlayFeedback ( Vector3  position,
float  feedbacksIntensity = 1.0f 
)
protectedvirtual

On play we make our renderer flicker

Parameters
position
feedbacksIntensity

Implements MoreMountains.Feedbacks.MMF_Feedback.

◆ CustomReset()

override void MoreMountains.Feedbacks.MMF_Flicker.CustomReset ( )
protectedvirtual

On reset we make our renderer stop flickering

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ CustomRestoreInitialValues()

override void MoreMountains.Feedbacks.MMF_Flicker.CustomRestoreInitialValues ( )
protectedvirtual

On restore, we put our object back at its initial position

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ CustomStopFeedback()

override void MoreMountains.Feedbacks.MMF_Flicker.CustomStopFeedback ( Vector3  position,
float  feedbacksIntensity = 1 
)
protectedvirtual

Stops this feedback

Parameters
position
feedbacksIntensity

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ Flicker()

virtual IEnumerator MoreMountains.Feedbacks.MMF_Flicker.Flicker ( Renderer  renderer,
int  materialIndex,
Color  initialColor,
Color  flickerColor,
float  flickerSpeed,
float  flickerDuration 
)
virtual

◆ SetColor()

virtual void MoreMountains.Feedbacks.MMF_Flicker.SetColor ( Renderer  renderer,
int  materialIndex,
Color  color 
)
protectedvirtual

◆ SetStoredSpriteRendererTexture()

virtual void MoreMountains.Feedbacks.MMF_Flicker.SetStoredSpriteRendererTexture ( Renderer  renderer,
MaterialPropertyBlock  block 
)
protectedvirtual

◆ StoreSpriteRendererTexture()

virtual void MoreMountains.Feedbacks.MMF_Flicker.StoreSpriteRendererTexture ( )
protectedvirtual

Member Data Documentation

◆ _colorPropertyName

const string MoreMountains.Feedbacks.MMF_Flicker._colorPropertyName = "_Color"
staticprotected

◆ _coroutines

Coroutine [] MoreMountains.Feedbacks.MMF_Flicker._coroutines
protected

◆ _extraCoroutines

List<Coroutine[]> MoreMountains.Feedbacks.MMF_Flicker._extraCoroutines
protected

◆ _extraInitialFlickerColors

List<Color[]> MoreMountains.Feedbacks.MMF_Flicker._extraInitialFlickerColors
protected

◆ _extraPropertyBlocks

List<MaterialPropertyBlock> MoreMountains.Feedbacks.MMF_Flicker._extraPropertyBlocks
protected

◆ _initialFlickerColors

Color [] MoreMountains.Feedbacks.MMF_Flicker._initialFlickerColors
protected

◆ _propertiesFound

bool [] MoreMountains.Feedbacks.MMF_Flicker._propertiesFound
protected

◆ _propertyBlock

MaterialPropertyBlock MoreMountains.Feedbacks.MMF_Flicker._propertyBlock
protected

◆ _propertyIDs

int [] MoreMountains.Feedbacks.MMF_Flicker._propertyIDs
protected

◆ _spriteRenderer

SpriteRenderer MoreMountains.Feedbacks.MMF_Flicker._spriteRenderer
protected

◆ _spriteRendererIsNull

bool MoreMountains.Feedbacks.MMF_Flicker._spriteRendererIsNull
protected

◆ _spriteRenderers

List<SpriteRenderer> MoreMountains.Feedbacks.MMF_Flicker._spriteRenderers
protected

◆ _spriteRendererTexture

Texture2D MoreMountains.Feedbacks.MMF_Flicker._spriteRendererTexture
protected

◆ _spriteRendererTextures

List<Texture2D> MoreMountains.Feedbacks.MMF_Flicker._spriteRendererTextures
protected

◆ BoundRenderer

Renderer MoreMountains.Feedbacks.MMF_Flicker.BoundRenderer

the renderer to flicker when played

◆ ExtraBoundRenderers

List<Renderer> MoreMountains.Feedbacks.MMF_Flicker.ExtraBoundRenderers

more renderers to flicker when played

◆ FeedbackTypeAuthorized

bool MoreMountains.Feedbacks.MMF_Flicker.FeedbackTypeAuthorized = true
static

a static bool used to disable all feedbacks of this type at once

◆ FlickerColor

Color MoreMountains.Feedbacks.MMF_Flicker.FlickerColor = new Color32(255, 20, 20, 255)

the color we should flicker the sprite to

◆ FlickerDuration

float MoreMountains.Feedbacks.MMF_Flicker.FlickerDuration = 0.2f

the duration of the flicker when getting damage

◆ FlickerPeriod

float MoreMountains.Feedbacks.MMF_Flicker.FlickerPeriod = 0.04f

the duration of the period for the flicker

◆ HasAutomatedTargetAcquisition

override bool MoreMountains.Feedbacks.MMF_Flicker.HasAutomatedTargetAcquisition => true

sets the inspector color for this feedback

◆ MaterialIndexes

int [] MoreMountains.Feedbacks.MMF_Flicker.MaterialIndexes

the list of material indexes we want to flicker on the target renderer. If left empty, will only target the material at index 0

◆ Mode

Modes MoreMountains.Feedbacks.MMF_Flicker.Mode = Modes.Color

the selected mode to flicker the renderer

◆ PropertyName

string MoreMountains.Feedbacks.MMF_Flicker.PropertyName = "_Tint"

the name of the property to target

◆ SpriteRendererTextureProperty

string MoreMountains.Feedbacks.MMF_Flicker.SpriteRendererTextureProperty = "_MainTex"

if using material property blocks on a sprite renderer, you'll want to make sure the sprite texture gets passed to the block when updating it. For that, you need to specify your sprite's material's shader's texture property name. If you're not working with a sprite renderer, you can safely ignore this.

◆ UseMaterialPropertyBlocks

bool MoreMountains.Feedbacks.MMF_Flicker.UseMaterialPropertyBlocks = false

if this is true, this component will use material property blocks instead of working on an instance of the material.

Property Documentation

◆ FeedbackDuration

override float MoreMountains.Feedbacks.MMF_Flicker.FeedbackDuration
getset

the duration of this feedback is the duration of the flicker


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