TopDown Engine  v4.1
MoreMountains.TopDownEngine.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.TopDownEngine.AppearDisappear:
MoreMountains.TopDownEngine.TopDownMonoBehaviour MoreMountains.Tools.MMMonoBehaviour

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...
 
Animator TargetAnimator
 the animator to update More...
 
GameObject TargetModel
 the game object to show/hide 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 ShowHideModel = false
 whether or not the object should hide/show a model 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
 
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.TopDownEngine.AppearDisappear.Activate ( bool  status)
virtual

Activates or disables the appearing/disappearing behaviour

Parameters
status

◆ ChangeState()

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

Changes the state for the next in line

◆ DetermineNextState()

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

Determines the next state this object should be in

◆ Initialization()

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

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

◆ OnTriggerEnter2D()

virtual void MoreMountains.TopDownEngine.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.TopDownEngine.AppearDisappear.ProcessStateMachine ( )
protectedvirtual

Changes the state to the next if time requires it

◆ ProcessTriggerArea()

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

◆ RandomizeDurations()

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

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

◆ ResetCycling()

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

◆ Start()

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

On start we initialize our object

◆ Update()

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

On Update we process our state machine

◆ UpdateBoundComponents()

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

Updates animator, collider and renderer according to the visible state

Parameters
visible

Member Data Documentation

◆ _animationParameter

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

◆ _characterInTriggerArea

bool MoreMountains.TopDownEngine.AppearDisappear._characterInTriggerArea = false
protected

◆ _collider

Collider MoreMountains.TopDownEngine.AppearDisappear._collider
protected

◆ _collider2D

Collider2D MoreMountains.TopDownEngine.AppearDisappear._collider2D
protected

◆ _currentState

AppearDisappearStates MoreMountains.TopDownEngine.AppearDisappear._currentState

the current state this object is in

◆ _cyclesLeft

int MoreMountains.TopDownEngine.AppearDisappear._cyclesLeft

◆ _hiddenDuration

float MoreMountains.TopDownEngine.AppearDisappear._hiddenDuration
protected

◆ _hiddenToVisibleDuration

float MoreMountains.TopDownEngine.AppearDisappear._hiddenToVisibleDuration
protected

◆ _lastStateChangedAt

float MoreMountains.TopDownEngine.AppearDisappear._lastStateChangedAt = 0f

the last time this object changed state

◆ _nextChangeIn

float MoreMountains.TopDownEngine.AppearDisappear._nextChangeIn
protected

◆ _nextFeedback

MMFeedbacks MoreMountains.TopDownEngine.AppearDisappear._nextFeedback
protected

◆ _nextState

AppearDisappearStates MoreMountains.TopDownEngine.AppearDisappear._nextState

the state this object will be in next

◆ _visibleDuration

float MoreMountains.TopDownEngine.AppearDisappear._visibleDuration
protected

◆ _visibleToHiddenDuration

float MoreMountains.TopDownEngine.AppearDisappear._visibleToHiddenDuration
protected

◆ Active

bool MoreMountains.TopDownEngine.AppearDisappear.Active = true

whether the object is active right now or not

◆ CyclesAmount

int MoreMountains.TopDownEngine.AppearDisappear.CyclesAmount = 1

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

◆ CyclingMode

CyclingModes MoreMountains.TopDownEngine.AppearDisappear.CyclingMode = CyclingModes.Forever

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

◆ EnableDisableCollider

bool MoreMountains.TopDownEngine.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.TopDownEngine.AppearDisappear.HiddenDuration = new Vector2(1f, 1f)

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

◆ HiddenFeedback

MMFeedbacks MoreMountains.TopDownEngine.AppearDisappear.HiddenFeedback

the feedback to trigger when reaching the hidden state

◆ HiddenToVisibleDuration

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

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

◆ HiddenToVisibleFeedback

MMFeedbacks MoreMountains.TopDownEngine.AppearDisappear.HiddenToVisibleFeedback

the feedback to trigger when reaching the hidden to visible state

◆ InitialOffset

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

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

◆ InitialState

AppearDisappearStates MoreMountains.TopDownEngine.AppearDisappear.InitialState

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

◆ PreventAppearWhenCharacterInArea

bool MoreMountains.TopDownEngine.AppearDisappear.PreventAppearWhenCharacterInArea = true

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

◆ PreventDisappearWhenCharacterInArea

bool MoreMountains.TopDownEngine.AppearDisappear.PreventDisappearWhenCharacterInArea = false

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

◆ ShowHideModel

bool MoreMountains.TopDownEngine.AppearDisappear.ShowHideModel = false

whether or not the object should hide/show a model when changing state

◆ StartMode

StartModes MoreMountains.TopDownEngine.AppearDisappear.StartMode = StartModes.Automatic

how the object should be activated

◆ TargetAnimator

Animator MoreMountains.TopDownEngine.AppearDisappear.TargetAnimator

the animator to update

◆ TargetModel

GameObject MoreMountains.TopDownEngine.AppearDisappear.TargetModel

the game object to show/hide

◆ TriggerArea

CharacterDetector MoreMountains.TopDownEngine.AppearDisappear.TriggerArea

the area used to detect the presence of a character

◆ UpdateAnimator

bool MoreMountains.TopDownEngine.AppearDisappear.UpdateAnimator = true

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

◆ VisibleDuration

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

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

◆ VisibleFeedback

MMFeedbacks MoreMountains.TopDownEngine.AppearDisappear.VisibleFeedback

the feedback to trigger when reaching the visible state

◆ VisibleToHiddenDuration

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

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

◆ VisibleToHiddenFeedback

MMFeedbacks MoreMountains.TopDownEngine.AppearDisappear.VisibleToHiddenFeedback

the feedback to trigger when reaching the visible to hidden state


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