private void ProcessInputs() { float horizontalInput = Input.GetAxis("Horizontal"); float depthInput = Input.GetAxis("Vertical"); if (horizontalInput != 0 || depthInput != 0) { m_moverComponent.activateMoverAction(MoverComponent.ActionTypeFlag.Run); if (m_runMover != null) { if (!m_runMover.getMoverBehavior().getMoveRelative()) { m_moverComponent.getTransform().forward = new Vector3(horizontalInput, 0, depthInput); } } } if (Input.GetKeyDown(KeyCode.Space)) { if (m_slideMover != null) { m_slideMover.pause(); } m_moverComponent.activateMoverAction(MoverComponent.ActionTypeFlag.Jump); } }
////////////////////////////////////////////////////////////////////////////////////////// #region Accessors ////////////////////////////////////////////////////////////////////////////////////////// #endregion ////////////////////////////////////////////////////////////////////////////////////////// #region Methods ////////////////////////////////////////////////////////////////////////////////////////// #endregion ////////////////////////////////////////////////////////////////////////////////////////// #region Runtime ////////////////////////////////////////////////////////////////////////////////////////// // Use this for initialization void Start() { if (m_moverComponent) { m_moverComponent.getActionMovers().TryGetValue(MoverComponent.ActionTypeFlag.Run, out m_runMover); m_moverComponent.activateMoverAction(MoverComponent.ActionTypeFlag.Run); } }
private void ProcessInputs() { float horizontalInput; if (Network.peerType == NetworkPeerType.Disconnected) { horizontalInput = Input.GetAxis("HorizontalGround"); } else { horizontalInput = Input.GetAxis("Horizontal"); } float depthInput = Input.GetAxis("Vertical"); if (Network.peerType == NetworkPeerType.Disconnected) { depthInput = Input.GetAxis("VerticalGround"); } else { depthInput = Input.GetAxis("Vertical"); } if (horizontalInput != 0 || depthInput != 0) { m_moverComponent.activateMoverAction(MoverComponent.ActionTypeFlag.Run); if (m_runMover != null) { if (!m_runMover.getMoverBehavior().getMoveRelative()) { m_moverComponent.getTransform().forward = new Vector3(horizontalInput, 0, depthInput); } } } float yawInput = Input.GetAxis("HorizontalRightStick"); //float pitchInput = Input.GetAxis("VerticalRightStick"); if (yawInput != 0) //|| pitchInput != 0) { //m_moverComponent.getTransform().Rotate(new Vector3(0, m_turnRate * yawInput, 0)); } if ((Network.peerType == NetworkPeerType.Disconnected && Input.GetButtonDown("JumpGround")) || Network.peerType != NetworkPeerType.Disconnected && Input.GetButtonDown("Jump")) { m_moverComponent.activateMoverAction(MoverComponent.ActionTypeFlag.Jump); } }
private void ProcessInputs() { if (Input.GetAxis("Horizontal") != 0) { m_moverComponent.activateMoverAction(MoverComponent.ActionTypeFlag.Run); } if (Input.GetKeyDown(KeyCode.Space)) { if (m_slideMover != null) { m_slideMover.pause(); } m_moverComponent.activateMoverAction(MoverComponent.ActionTypeFlag.Jump); } }
// Returns true if the action was successfully executed. public override bool execute() { m_moverComponent.getObserver().add(createMoverListener()); m_moverComponent.activateMoverAction(m_actionTypeFlag); return(true); }