Changing State in PlayerControler from PlayerInput
- by Jeremy Talus
In my player input I wanna change the the "State" of my player controller
but I have some trouble to do it
my player input is declared like that :
class ResistancePlayerInput extends PlayerInput within ResistancePlayerController
config(ResistancePlayerInput);
and in my playerControler I have that :
class ResistancePlayerController extends GamePlayerController;
var name PreviousState;
DefaultProperties
{
CameraClass = class 'ResistanceCamera' //Telling the player controller to use your custom camera script
InputClass = class'ResistanceGame.ResistancePlayerInput'
DefaultFOV = 90.f //Telling the player controller what the default field of view (FOV) should be
}
simulated event PostBeginPlay()
{
Super.PostBeginPlay();
}
auto state Walking {
event BeginState(name PreviousStateName) {
Pawn.GroundSpeed = 200;
`log("Player Walking");
}
}
state Running extends Walking {
event BeginState(name PreviousStateName) {
Pawn.GroundSpeed = 350;
`log("Player Running");
}
}
state Sprinting extends Walking {
event BeginState(name PreviousStateName) {
Pawn.GroundSpeed = 800;
`log("Player Sprinting");
}
}
I have tried to use
PCOwner.GotoState(); and ResistancePlayerController(PCOwner).GotoState(); but won't work.
I have also tried a simple GotoState, and nothing happen
how can I call GotoState for the PC Class from my player input ?