// Update is called once per frame void Update() { //Check for softness switch if (PlayerSettings.controllerControl) { if (Input.GetButton("Harden")) { //switch to hard softness = PlayerSoftness.HARD; } else if (Input.GetButton("Soften")) { //switch to soft softness = PlayerSoftness.SOFT; } else { //switch to bouncy softness = PlayerSoftness.BOUNCY; } if (formerSoftness != softness) { OnStateSwitch(); } } else { if (Input.GetKey(KeyCode.E)) { //switch to hard softness = PlayerSoftness.HARD; } else if (Input.GetKey(KeyCode.Q)) { //switch to soft softness = PlayerSoftness.SOFT; } else { //switch to bouncy softness = PlayerSoftness.BOUNCY; } if (formerSoftness != softness) { OnStateSwitch(); } } formerSoftness = softness; }
// Start is called before the first frame update void Start() { softness = PlayerSoftness.BOUNCY; formerSoftness = PlayerSoftness.BOUNCY; }