Corgi Engine  v8.8
MoreMountains.CorgiEngine.AppearDisappear Class Reference

Add this class to an object (usually a platform but it could be anything really) to have it run on an appearing/disappearing loop, like the appearing platforms in Megaman for example. More...

Inheritance diagram for MoreMountains.CorgiEngine.AppearDisappear:
MoreMountains.CorgiEngine.CorgiMonoBehaviour

Public Types

enum  AppearDisappearStates { AppearDisappearStates.Visible, AppearDisappearStates.Hidden, AppearDisappearStates.VisibleToHidden, AppearDisappearStates.HiddenToVisible }
 the possible states this object can be in More...
 
enum  StartModes { StartModes.Automatic, StartModes.PlayerContact, StartModes.Script }
 the possible start modes (automatic will start on Start, PlayerContact when an object with the Player tag collides with the object, and Script lets you trigger that manually More...
 
enum  CyclingModes { CyclingModes.Forever, CyclingModes.Limited }
 

Public Member Functions

virtual void Activate (bool status)
 Activates or disables the appearing/disappearing behaviour More...
 
virtual void ChangeState ()
 Changes the state for the next in line More...
 
virtual void OnTriggerEnter2D (Collider2D collider)
 When colliding with another object, we check if it's a player, and if it is and we are supposed to start on player contact, we enable our object More...
 
virtual void ResetCycling ()
 

Public Attributes

bool Active = true
 whether the object is active right now or not More...
 
AppearDisappearStates InitialState
 the initial state (visible or hidden) the object should start in More...
 
StartModes StartMode = StartModes.Automatic
 how the object should be activated More...
 
CyclingModes CyclingMode = CyclingModes.Forever
 how the object should cycle states (forever, a limited amount of times, or never) More...
 
int CyclesAmount = 1
 the number of cycles this object can go through before it stops (only used if CyclingMode is Limited) More...
 
Vector2 InitialOffset = new Vector2(0f, 0f)
 the initial offset to apply to the object's first state change (in seconds) More...
 
Vector2 VisibleDuration = new Vector2(1f, 1f)
 the min and max duration of the visible state (in seconds) More...
 
Vector2 HiddenDuration = new Vector2(1f, 1f)
 the min and max duration of the hidden state (in seconds) More...
 
Vector2 VisibleToHiddenDuration = new Vector2(1f, 1f)
 the min and max duration of the visible to hidden state (in seconds) More...
 
Vector2 HiddenToVisibleDuration = new Vector2(1f, 1f)
 the min and max duration of the hidden to visible state (in seconds) More...
 
MMFeedbacks VisibleFeedback
 the feedback to trigger when reaching the visible state More...
 
MMFeedbacks VisibleToHiddenFeedback
 the feedback to trigger when reaching the visible to hidden state More...
 
MMFeedbacks HiddenFeedback
 the feedback to trigger when reaching the hidden state More...
 
MMFeedbacks HiddenToVisibleFeedback
 the feedback to trigger when reaching the hidden to visible state More...
 
bool UpdateAnimator = true
 whether or not the object should update its animator (set at the same level) when changing state More...
 
bool EnableDisableCollider = true
 whether or not the object should update its Collider or Collider2D (set at the same level) when changing state More...
 
bool ShowHideRenderer = false
 whether or not the object should update its renderer (set at the same level) when changing state More...
 
CharacterDetector TriggerArea
 the area used to detect the presence of a character More...
 
bool PreventAppearWhenCharacterInArea = true
 whether or not we should prevent this component from appearing when a character is in the area More...
 
bool PreventDisappearWhenCharacterInArea = false
 whether or not we should prevent this component from disappearing when a character is in the area More...
 
AppearDisappearStates _currentState
 the current state this object is in More...
 
AppearDisappearStates _nextState
 the state this object will be in next More...
 
float _lastStateChangedAt = 0f
 the last time this object changed state More...
 
int _cyclesLeft
 

Protected Member Functions

virtual void Start ()
 On start we initialize our object More...
 
virtual void Initialization ()
 On Init, we set our active state, grab components, and determine our next state More...
 
virtual void Update ()
 On Update we process our state machine More...
 
virtual void ProcessTriggerArea ()
 
virtual void ProcessStateMachine ()
 Changes the state to the next if time requires it More...
 
virtual void DetermineNextState ()
 Determines the next state this object should be in More...
 
virtual void UpdateBoundComponents (bool visible)
 Updates animator, collider and renderer according to the visible state More...
 
virtual void RandomizeDurations ()
 Randomizes the durations of each state based on the mins and maxs set in the inpector More...
 

Protected Attributes

float _visibleDuration
 
float _hiddenDuration
 
float _visibleToHiddenDuration
 
float _hiddenToVisibleDuration
 
float _nextChangeIn
 
MMFeedbacks _nextFeedback
 
Animator _animator
 
Renderer _renderer
 
Collider _collider
 
Collider2D _collider2D
 
bool _characterInTriggerArea = false
 

Static Protected Attributes

const string _animationParameter = "Visible"
 

Detailed Description

Add this class to an object (usually a platform but it could be anything really) to have it run on an appearing/disappearing loop, like the appearing platforms in Megaman for example.

Member Enumeration Documentation

◆ AppearDisappearStates

the possible states this object can be in

Enumerator
Visible 
Hidden 
VisibleToHidden 
HiddenToVisible 

◆ CyclingModes

Enumerator
Forever 
Limited 

◆ StartModes

the possible start modes (automatic will start on Start, PlayerContact when an object with the Player tag collides with the object, and Script lets you trigger that manually

Enumerator
Automatic 
PlayerContact 
Script 

Member Function Documentation

◆ Activate()

virtual void MoreMountains.CorgiEngine.AppearDisappear.Activate ( bool  status)
virtual

Activates or disables the appearing/disappearing behaviour

Parameters
status

◆ ChangeState()

virtual void MoreMountains.CorgiEngine.AppearDisappear.ChangeState ( )
virtual

Changes the state for the next in line

◆ DetermineNextState()

virtual void MoreMountains.CorgiEngine.AppearDisappear.DetermineNextState ( )
protectedvirtual

Determines the next state this object should be in

◆ Initialization()

virtual void MoreMountains.CorgiEngine.AppearDisappear.Initialization ( )
protectedvirtual

On Init, we set our active state, grab components, and determine our next state

◆ OnTriggerEnter2D()

virtual void MoreMountains.CorgiEngine.AppearDisappear.OnTriggerEnter2D ( Collider2D  collider)
virtual

When colliding with another object, we check if it's a player, and if it is and we are supposed to start on player contact, we enable our object

Parameters
collider

◆ ProcessStateMachine()

virtual void MoreMountains.CorgiEngine.AppearDisappear.ProcessStateMachine ( )
protectedvirtual

Changes the state to the next if time requires it

◆ ProcessTriggerArea()

virtual void MoreMountains.CorgiEngine.AppearDisappear.ProcessTriggerArea ( )
protectedvirtual

◆ RandomizeDurations()

virtual void MoreMountains.CorgiEngine.AppearDisappear.RandomizeDurations ( )
protectedvirtual

Randomizes the durations of each state based on the mins and maxs set in the inpector

◆ ResetCycling()

virtual void MoreMountains.CorgiEngine.AppearDisappear.ResetCycling ( )
virtual

◆ Start()

virtual void MoreMountains.CorgiEngine.AppearDisappear.Start ( )
protectedvirtual

On start we initialize our object

◆ Update()

virtual void MoreMountains.CorgiEngine.AppearDisappear.Update ( )
protectedvirtual

On Update we process our state machine

◆ UpdateBoundComponents()

virtual void MoreMountains.CorgiEngine.AppearDisappear.UpdateBoundComponents ( bool  visible)
protectedvirtual

Updates animator, collider and renderer according to the visible state

Parameters
visible

Member Data Documentation

◆ _animationParameter

const string MoreMountains.CorgiEngine.AppearDisappear._animationParameter = "Visible"
staticprotected

◆ _animator

Animator MoreMountains.CorgiEngine.AppearDisappear._animator
protected

◆ _characterInTriggerArea

bool MoreMountains.CorgiEngine.AppearDisappear._characterInTriggerArea = false
protected

◆ _collider

Collider MoreMountains.CorgiEngine.AppearDisappear._collider
protected

◆ _collider2D

Collider2D MoreMountains.CorgiEngine.AppearDisappear._collider2D
protected

◆ _currentState

AppearDisappearStates MoreMountains.CorgiEngine.AppearDisappear._currentState

the current state this object is in

◆ _cyclesLeft

int MoreMountains.CorgiEngine.AppearDisappear._cyclesLeft

◆ _hiddenDuration

float MoreMountains.CorgiEngine.AppearDisappear._hiddenDuration
protected

◆ _hiddenToVisibleDuration

float MoreMountains.CorgiEngine.AppearDisappear._hiddenToVisibleDuration
protected

◆ _lastStateChangedAt

float MoreMountains.CorgiEngine.AppearDisappear._lastStateChangedAt = 0f

the last time this object changed state

◆ _nextChangeIn

float MoreMountains.CorgiEngine.AppearDisappear._nextChangeIn
protected

◆ _nextFeedback

MMFeedbacks MoreMountains.CorgiEngine.AppearDisappear._nextFeedback
protected

◆ _nextState

AppearDisappearStates MoreMountains.CorgiEngine.AppearDisappear._nextState

the state this object will be in next

◆ _renderer

Renderer MoreMountains.CorgiEngine.AppearDisappear._renderer
protected

◆ _visibleDuration

float MoreMountains.CorgiEngine.AppearDisappear._visibleDuration
protected

◆ _visibleToHiddenDuration

float MoreMountains.CorgiEngine.AppearDisappear._visibleToHiddenDuration
protected

◆ Active

bool MoreMountains.CorgiEngine.AppearDisappear.Active = true

whether the object is active right now or not

◆ CyclesAmount

int MoreMountains.CorgiEngine.AppearDisappear.CyclesAmount = 1

the number of cycles this object can go through before it stops (only used if CyclingMode is Limited)

◆ CyclingMode

CyclingModes MoreMountains.CorgiEngine.AppearDisappear.CyclingMode = CyclingModes.Forever

how the object should cycle states (forever, a limited amount of times, or never)

◆ EnableDisableCollider

bool MoreMountains.CorgiEngine.AppearDisappear.EnableDisableCollider = true

whether or not the object should update its Collider or Collider2D (set at the same level) when changing state

◆ HiddenDuration

Vector2 MoreMountains.CorgiEngine.AppearDisappear.HiddenDuration = new Vector2(1f, 1f)

the min and max duration of the hidden state (in seconds)

◆ HiddenFeedback

MMFeedbacks MoreMountains.CorgiEngine.AppearDisappear.HiddenFeedback

the feedback to trigger when reaching the hidden state

◆ HiddenToVisibleDuration

Vector2 MoreMountains.CorgiEngine.AppearDisappear.HiddenToVisibleDuration = new Vector2(1f, 1f)

the min and max duration of the hidden to visible state (in seconds)

◆ HiddenToVisibleFeedback

MMFeedbacks MoreMountains.CorgiEngine.AppearDisappear.HiddenToVisibleFeedback

the feedback to trigger when reaching the hidden to visible state

◆ InitialOffset

Vector2 MoreMountains.CorgiEngine.AppearDisappear.InitialOffset = new Vector2(0f, 0f)

the initial offset to apply to the object's first state change (in seconds)

◆ InitialState

AppearDisappearStates MoreMountains.CorgiEngine.AppearDisappear.InitialState

the initial state (visible or hidden) the object should start in

◆ PreventAppearWhenCharacterInArea

bool MoreMountains.CorgiEngine.AppearDisappear.PreventAppearWhenCharacterInArea = true

whether or not we should prevent this component from appearing when a character is in the area

◆ PreventDisappearWhenCharacterInArea

bool MoreMountains.CorgiEngine.AppearDisappear.PreventDisappearWhenCharacterInArea = false

whether or not we should prevent this component from disappearing when a character is in the area

◆ ShowHideRenderer

bool MoreMountains.CorgiEngine.AppearDisappear.ShowHideRenderer = false

whether or not the object should update its renderer (set at the same level) when changing state

◆ StartMode

StartModes MoreMountains.CorgiEngine.AppearDisappear.StartMode = StartModes.Automatic

how the object should be activated

◆ TriggerArea

CharacterDetector MoreMountains.CorgiEngine.AppearDisappear.TriggerArea

the area used to detect the presence of a character

◆ UpdateAnimator

bool MoreMountains.CorgiEngine.AppearDisappear.UpdateAnimator = true

whether or not the object should update its animator (set at the same level) when changing state

◆ VisibleDuration

Vector2 MoreMountains.CorgiEngine.AppearDisappear.VisibleDuration = new Vector2(1f, 1f)

the min and max duration of the visible state (in seconds)

◆ VisibleFeedback

MMFeedbacks MoreMountains.CorgiEngine.AppearDisappear.VisibleFeedback

the feedback to trigger when reaching the visible state

◆ VisibleToHiddenDuration

Vector2 MoreMountains.CorgiEngine.AppearDisappear.VisibleToHiddenDuration = new Vector2(1f, 1f)

the min and max duration of the visible to hidden state (in seconds)

◆ VisibleToHiddenFeedback

MMFeedbacks MoreMountains.CorgiEngine.AppearDisappear.VisibleToHiddenFeedback

the feedback to trigger when reaching the visible to hidden state


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