FPSController Editing

The FPSController Variables

The included FPSController is from the Unity Standard Assets, and I have edited the variables in that script to make sure they're accessible in the "GMController" - So they can be easily edited and modified when you enter and exit the gas to slow the player. See below on the variables that should be public or set them in set them in such a way that they're accessible in your controller.

namespace UnityStandardAssets.Characters.FirstPerson
{
    [RequireComponent(typeof (CharacterController))]
    [RequireComponent(typeof (AudioSource))]
    public class FirstPersonController : MonoBehaviour
    {
        [SerializeField] private bool m_IsWalking = false;
        public float m_WalkSpeed;
        public float m_RunSpeed;
        [SerializeField] [Range(0f, 1f)] private float m_RunstepLenghten = 0.14f;
 

Editing the GMController script

In the "GMController" script you will find a method called "PlayerMovement" you can edit this along with the "walkGas, runGas, walkNorm, runNorm" variables in this script to change the values of the FPSController. Even edit this method if you want to incorporate your own controller.

void PlayerMovement(bool slowPlayer)
        {
            if (slowPlayer)
            {
                player.m_WalkSpeed = walkGas;
                player.m_RunSpeed = runGas;
            }
            else
            {
                player.m_WalkSpeed = walkNorm;
                player.m_RunSpeed = runNorm;
            }
        }

Last updated