public void Update() { horizontalInput = Input.GetAxisRaw("Horizontal"); FlyingState fs = new FlyingState(horizontalInput); fs.setTargetHold(fs.findClosestAnchor()); SwingingState ss; checkValidity(); if (!_parent.GroundCheck()) { Print.Log("STATE TRANSITION grounded -> flying"); _parent.currentState = fs; return; } if (Input.GetKeyDown(KeyCode.Space)) { if (fs.targetHold != null) { Print.Log("STATE TRANSITION grounded -> swinging"); ss = new SwingingState(fs.targetHold); _parent.currentState = ss; // Play hook audio AudioManager.instance.Play("hook"); } } _parent.Walk(horizontalInput); }
public void ResetTongueIfSwinging() { if (currentState is SwingingState) { SwingingState swingingState = (SwingingState)currentState; swingingState.ResetTongue(); } }