Additional Conditions are available from v1.1.4 onwards. Additional Conditions are not available in LE.
Additional conditions allow you to add extra constraints to:
Platforms - So they only apply collisions (or ignore collisions) under certain conditions.
Attacks - So they are only triggered in certain conditions.
Triggers - So they only fire in certain conditions.
Doors - So they only open or close in certain conditions.
Movements - So they only gain control under certain circumstances (from v1.1.5 onwards).
This allows you to easily create a wide variety of interesting gameplay elements such as:
- A special Platform that can only be passed through when a user holds a magic wand.
- A super attack that can only trigger when the user has a full super meter.
- A door which only opens when a certain physics object is pushed on to a plate.
Adding an Additional Condition
Additional conditions can be added by simply adding an AdditionalCondition component to the the same GameObject as a Platform, Door, Trigger or Attack Component.
Currently the following conditions are available (but more are always being added):
ActiveMovementCondition - This condition requires the character be under the control of a specific movement.
ActiveMovementNotInListCondition - This condition requires the character not be under the control of any of the movements in the list.
FacingDirectionCondition - This condition requires the character to be facing a certain direction.
HeightCondition - Requires the character to be at a certain height. This can either be relative or absolute.
InputDirectionCondition - Requires the user to be pressing a certain direction. Horizontal directions can be relative to facing direction.
IsInColliderCondition - Requires the *centre* of the Characters transform to be inside a given collider.
MustBeAirborneCondition - This condition requires the character to be in the air.
MustBeGroundedCondition - This condition requires the character to be on the ground.
MustHaveItemCondition - Requires the character to have a specific item in their inventory.
PowerUpActiveCondition - Requires the character to have a given power-up. Makes it easy to enable different movements based on a power-up.
From v1.1.5 onwards, conditions can also do things when activated. The most common use of this is to consume items when all conditions are met (for example on a super attack that has multiple conditions).
By default if multiple AdditionalConditions are added to an object then those conditions must ALL be met in order for the condition check to pass.
If you wish to create more complex interactions you can use the OrConditionCombiner and the AndConditionCombiner to construct a boolean combination of conditions.
When you use these combiners you should add the other conditions to a GameObject that is a child of the main GameObject that contains the Platform, Door, Trigger or Attack. For example to create a platform which requires the user to have press UP or DOWN to activate:
- Add an OrConditionCombiner to the GameObject with the Platform component (the Platform GameObject).
- Create an empty child GameObject on the Platform GameObject and call it ChildGameObject-Up. Create another child and call it ChildGameObject-Down.
- Add and InputDirectionConditions to each child GameObject
- Configure one of these InputDirectionConditions to require the UP key and one to require the DOWN key.
- Assign both of these InputDirectionConditions to the conditions list in the OrConditionCombiner.
Apply on Inverse
Apply on Inverse means the condition will also be checked when the negative or inverse action occurs: specifically the Leave event for triggers and the Close action for Doors.
If the box is unchecked these actions will always happen as normal. If checked then they will also have the conditions applied.