Class Transition
java.lang.Object
de.gurkenlabs.litiengine.entities.behavior.Transition
- All Implemented Interfaces:
Comparable<Transition>
- Direct Known Subclasses:
EntityTransition
Represents a transition with a priority and a target state.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTransition(int priority) Initializes a new instance of the Transition class with the specified priority.protectedTransition(int priority, State targetState) Initializes a new instance of the Transition class with the specified priority and target state. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(Transition other) Compares this transition with another transition based on their priorities.protected abstract booleanChecks if the conditions for the transition are fulfilled.Gets the next state of the transition.intGets the priority of the transition.
-
Constructor Details
-
Transition
protected Transition(int priority) Initializes a new instance of the Transition class with the specified priority.- Parameters:
priority- the priority of the transition
-
Transition
Initializes a new instance of the Transition class with the specified priority and target state.- Parameters:
priority- the priority of the transitiontargetState- the target state of the transition
-
-
Method Details
-
compareTo
Compares this transition with another transition based on their priorities.- Specified by:
compareToin interfaceComparable<Transition>- Parameters:
other- the other transition to compare with- Returns:
- a negative integer, zero, or a positive integer as this transition's priority is less than, equal to, or greater than the specified transition's priority
-
getNextState
Gets the next state of the transition.- Returns:
- the next state of the transition
-
getPriority
public int getPriority()Gets the priority of the transition.- Returns:
- the priority of the transition
-
conditionsFullfilled
protected abstract boolean conditionsFullfilled()Checks if the conditions for the transition are fulfilled.- Returns:
- true if the conditions are fulfilled, false otherwise
-