...
Variable Name | Variable type | Playmaker or Animator Integration? | Description | Default Variable Setting: |
---|---|---|---|---|
Movement UP | Keyboard Input | The input needed to move up. (+Y) | W | |
Movement DOWN | Keyboard Input | The input needed to move down. (-Y) | S | |
Movement LEFT | Keyboard Input | The input needed to move left. (-X) | A | |
Movement RIGHT | Keyboard Input | The input needed to move Right. (+X) | D | |
Action Button 1 | Keyboard Input | The input needed to count an action. | Spacebar | |
Movement Distance | Float | The distance in unity units the player moves per successful input | 1 | |
Movement Time | Float | The time in seconds it takes for the player character to physically move from the initial location to the destination location. Setting to -1 will equate to instant movement. | 0.1 | |
Next Movement Delay | Float | The time in seconds that the player has to wait until another movement input will register and send off checks. Setting to -1 will equate to no delay | 0.1 | |
Next Action Delay | Float | The time in seconds that the player has to wait until they can perform another action after completing one. Setting to -1 will equate to no delay | 0.1 | |
Playmaker Integrations: | ||||
On Beat Check | Bool Name | Playmaker global variable | The name of the playmaker global variable bool that it checks to see if the input was made “On Beat” The true / false state of this variable is determined external to this script. | On Beat? |
On Beat Move Success | Bool Name | Playmaker global variable | The name of the playmaker global variable bool this script sets to true if the “On Beat Check” comes back as true on a movement input. A playmaker state machine will check for the true change and then reset it back to false after an amount of time. | On Beat Move Success |
On Beat Interaction Success | Bool Name | Playmaker global variable | The name of the playmaker global variable bool this script sets to true if the “On Beat Check” comes back as true on a object interaction input. A playmaker state machine will check for the true change and then reset it back to false after an amount of time. | On Beat Interaction Success |
Movement Disabled | Bool Name | Playmaker global variable | The name of the playmaker global variable this script checks to see if it needs to disable movement. The script should be making this check quite often. | Move Disabled? |
Unity Animator Integrations: | ||||
Animator Component Location | Object Path | The path location of the object that has the character “animator” component attached to it. | (None) | |
Movement Animator Name | Trigger (Animator) Name | Animator | The name of the animator trigger variable it triggers when a successful movement is made. | Character Move |
On Beat Move Animator Name | Trigger (Animator) Name | Animator | The name of the animator trigger variable that it triggers when a movement is made “On Beat” | Character On Beat |
No Movement Animator Name | Trigger (Animator) Name | Animator | The name of the animator trigger variable that it triggers when an input resulted in no movement. | Character No Movement |
Player Controller Update: Written 26th of July - 2021
As development has continued some extra functionality is needed to intergrate the player controller with more variables and playmaker state machine triggers.
Stamina Integration:
Stamina is the resource that’s spent when the player character attacks or interacts with the world and it’s entities.
...
It’s now also a resource that sits at a Maximum until interactions “Drain” the resource. It’s replenished over-time by recharging itself.
There now exists the situation where attacks and interactions with the world shouldn’t happen if the stamina cost is more then the amount of stamina available.
New functionality needed:
Lowest Stamina Interaction Cost:
1: The player movement controller Script needs to be aware of the playmaker INT global variable “Player Stamina”
2: The Player Movement Controller Script needs to deny the “Interact” input (In the input manager) if the player stamina amount is below a pre-determined INT amount.
Meaning: The player cannot attack if there’s not enough stamina to pay for the attack.
3: The said pre-determined amount should be a tweakable INT number in the inspector. Named “Lowest Stamina Interact Cost”
Example: If the “Lowest Stamina Interact Cost” is set to 4. Then the player can’t attack if the amount of “Player Stamina” is 3 when the Interact input is made.
Stunned disables Interact Input:
I’ve created a “Stunned” state that occurs for a time after the player character gets hit by an enemy.
This is handled in the playmaker FSM object: “Logic - Stunned Logic”
When the player character is stunned a playmaker global bool called “Player Stunned” is set to “True”
When this playmaker global bool is true I’d like the “interact” input to be disabled.
Meaning: If the player character is stunned, they cant attack.
New Animator Variable Settings in Inspector:
Animator Character Attack
If the player hits the “interact” input successfully.
(Note: I’m currently “Fudging” this via the playmaker FSM object “Logic - Attack Sprite Animation”)
Animator Character Attack Failed
If the player hits the “Interact” input but doesn’t have the player stamina to pay for it.
Global Variable Name | Variable type | Playmaker or Animator Integration? | Description | Default Variable Setting: |
---|---|---|---|---|
Stunned? | Bool | Playmaker | ||
Keyboard Input | The input needed to move down. (-Y) | S | ||
Keyboard Input | The input needed to move left. (-X) | A |