change object state using enum switch from another script

I’ve searched extensively and either I’m not seeing/getting it, or the question isn’t answered.

I have simple Script to control the player, and use an enum to control the characters state:

 public void SetState(pState p) {
        playerState = p;
        r = GetComponent<Rigidbody>();

        switch (playerState) {

            case pState.ascend:
                Debug.Log("Flap");
                r.AddForce(Vector3.up * 10, ForceMode.Impulse);
                playerState = pState.descend;
                break;

            case pState.descend:
                Debug.Log("falling");
            break;

            case pState.dead:
                Debug.Log("dead");
            break;

        }
    }

Another script handles the input and when space is pressed should change the players state, like so:

using UnityEngine;
using System.Collections;

public class UserInput : MonoBehaviour {

    public GameObject p;
    public PlayerScript ps;

    void Start () {
        ps = p.GetComponent<PlayerScript>(); 
	}
	
	void Update () {

        if (Input.GetKeyDown(KeyCode.Space)) {
            ps.playerState = pState.ascend;
        }
    }
}

Please can someone explain what I’m doing wrong/why this doesn’t work? Bonus points if you can guess what game I’m emulating.

Thanks

Dan

Robert Miles has a pretty good chapter on Objects, Structures and References. I’d start here: http://www.csharpcourse.com/