private void OnDestroy() { if (this == instance) { instance = null; } }
public void Enter(BurinkeruInputManager inputManager, BurinkeruCharacterController parent, CharacterComponents components) { this.inputManager = inputManager; this.components = components; base.Enter(parent); }
Vector3 getMoveDirection() { Vector3 forwardDirection = parent.transform.forward; Vector3 rightDirection = parent.transform.right; Vector3 deltaPosition = Vector3.zero; BurinkeruInputManager inputManager = BurinkeruInputManager.Instance; if (inputManager.IsCommandPressed(BurinkeruInputManager.InputCommand.FORWARD)) { deltaPosition += (forwardDirection); } else if (inputManager.IsCommandPressed(BurinkeruInputManager.InputCommand.BACKWARD)) { deltaPosition -= (forwardDirection); } if (inputManager.IsCommandPressed(BurinkeruInputManager.InputCommand.RIGHT)) { deltaPosition += (rightDirection); } else if (inputManager.IsCommandPressed(BurinkeruInputManager.InputCommand.LEFT)) { deltaPosition -= (rightDirection); } deltaPosition.Normalize(); deltaPosition.Scale(new Vector3(1f, 0f, 1f)); return(deltaPosition); }
public override void UpdateState() { BurinkeruInputManager inputManager = BurinkeruInputManager.Instance; if (inputManager.IsCommandDown(BurinkeruInputManager.InputCommand.JUMP)) { jump(); } else if (inputManager.IsCommandDown(BurinkeruInputManager.InputCommand.RUN) && IsRunStateAvailable) { switchRunIfNeeded(); } else if (inputManager.IsCommandDown(BurinkeruInputManager.InputCommand.CROUCH) && IsCrounchStateAvailable) { switchCrouchOrSlideIfNeeded(); } else if (inputManager.IsCommandDown(BurinkeruInputManager.InputCommand.BLINK) && IsBlinkStateAvailable && blinkState.CanBlinkNow()) { requestNewState <BlinkState> (); } base.UpdateState(); }
private void Awake() { if (instance == null) { instance = this; initControllers(); } else { Destroy(this.gameObject); } }
public override void UpdateState() { changeStateIfNeeded(); applyGravity(); move(); BurinkeruInputManager inputManager = BurinkeruInputManager.Instance; if (inputManager.IsCommandDown(BurinkeruInputManager.InputCommand.JUMP)) { if (IsWallRunStateAvailable) { wallRunState.StartInitializationTimer(); } jumpPressed = true; } else if (inputManager.IsCommandUp(BurinkeruInputManager.InputCommand.JUMP)) { wallRunState.StopInitializationTimer(); if (jumpPressed) { jumpPressed = false; tryToJump(); } } if (IsWallRunStateAvailable && wallRunState.ShouldStartWallRunState(parent)) { wallRunState.StopInitializationTimer(); requestNewState <WallRunState> (); } else if (inputManager.IsCommandDown(BurinkeruInputManager.InputCommand.BLINK) && IsBlinkStateAvailable && blinkState.CanBlinkNow()) { requestNewState <BlinkState> (); } clampHorizontalVelocity(); }
public InputBuffer() { initBuffer(); inputManager = BurinkeruInputManager.Instance; }
private void Awake() { inputManager = BurinkeruInputManager.Instance; BlinkCounter = 0; }
// Start is called before the first frame update void Start() { inputManager = BurinkeruInputManager.Instance; setNewState <PlayerInAirState> (); blinkingController.OnBlink += onBlink; }
protected new void Awake() { base.Awake(); inputManager = BurinkeruInputManager.Instance; }