public void Update( IEnumerable<FTouch> touches, InputDevice device, float updateTime ) { foreach (var touch in touches) { UpdateWithTouch( touch ); } device.GetControl( xAxis ).UpdateWithValue( value.x, updateTime ); device.GetControl( yAxis ).UpdateWithValue( value.y, updateTime ); alpha = Mathf.MoveTowards( alpha, touchId == -1 ? 0.5f : 1.0f, 1.0f / 15.0f ); headSprite.SetPosition( delta ); }
public void Update(IEnumerable <FTouch> touches, InputDevice device, float updateTime) { foreach (var touch in touches) { UpdateWithTouch(touch); } device.GetControl(xAxis).UpdateWithValue(value.x, updateTime); device.GetControl(yAxis).UpdateWithValue(value.y, updateTime); alpha = Mathf.MoveTowards(alpha, touchId == -1 ? 0.5f : 1.0f, 1.0f / 15.0f); headSprite.SetPosition(delta); }
void Update() { //Check for A button to change scene to correct boss inputDevice = InputManager.ActiveDevice; if(Input.GetKeyDown(KeyCode.A) || inputDevice.GetControl(InputControlType.Action1).WasPressed){ GameController.LoadLastScene(); } }
//Check for interact void OnTriggerStay(Collider c) { InControl.InputDevice input = InControl.InputManager.ActiveDevice; if (c.transform.tag == "Interactable" && (input.GetControl(InControl.InputControlType.Action1) || input.GetControl(InControl.InputControlType.Action3) || Input.GetKeyDown(KeyCode.X) || Input.GetKeyDown(KeyCode.Space))) { c.GetComponent <iInteractable>().Use(this.gameObject); } }
public override float GetValue( InputDevice inputDevice ) { if (inputDevice == null) { return 0.0f; } return inputDevice.GetControl( Control ).Value; }
public override bool GetState(InputDevice inputDevice) { if (inputDevice == null) { return(false); } return(inputDevice.GetControl(Control).State); }
public override bool GetState( InputDevice inputDevice ) { if (inputDevice == null) { return false; } return inputDevice.GetControl( Control ).State; }
public override float GetValue(InputDevice inputDevice) { if (inputDevice == null) { return(0.0f); } return(inputDevice.GetControl(Control).Value); }
internal float GetValue(InputDevice device) { if (device == null) { return(0f); } float value = device.GetControl(Control).Value; return(InputRange.Remap(value, SourceRange, InputRangeType.ZeroToOne)); }
public void Update(IEnumerable <FTouch> touches, InputDevice device, float updateTime) { value = 0.0f; foreach (var touch in touches) { UpdateWithTouch(touch); } device.GetControl(controlType).UpdateWithValue(value, updateTime); alpha = Mathf.MoveTowards(alpha, value > 0.0f ? 1.0f : 0.5f, 1.0f / 15.0f); }
public static void CheckButtonEvents(IC.InputControlType type, IC.InputDevice device, GameObject player, Message?pressedEvent = null, Message?releasedEvent = null) { if (device != null) { IC.InputControl button = device.GetControl(type); SendButtonEvent(button.WasPressed, button.WasReleased, player, pressedEvent, releasedEvent); } }
public void Update( IEnumerable<FTouch> touches, InputDevice device, float updateTime ) { value = 0.0f; foreach (var touch in touches) { UpdateWithTouch( touch ); } device.GetControl( controlType ).UpdateWithValue( value, updateTime ); alpha = Mathf.MoveTowards( alpha, value > 0.0f ? 1.0f : 0.5f, 1.0f / 15.0f ); }
void Update() { //Check for A button to change scene to correct boss inputDevice = InputManager.ActiveDevice; if(Input.GetKeyDown(KeyCode.A) || inputDevice.GetControl(InputControlType.Action1).WasPressed){ if(bossNum == 1){ SceneManager.LoadScene("Boss - Aggression"); } else if(bossNum == 2){ SceneManager.LoadScene("Boss - Serenity"); } else{ SceneManager.LoadScene("Boss - Greed"); } } }
public override bool GetState(InputDevice inputDevice) { return(inputDevice?.GetControl(Control).State ?? false); }
public override float GetValue(InputDevice inputDevice) { return(inputDevice?.GetControl(Control).Value ?? 0f); }
public void UpdateControls() { if (inControlDevice == null || controllerId == -1) { if (INPUTS_TABLE_DEBUG) { Debug.Log("Unmapped controller"); } return; } else { LeftAnalogForwardAxis = inControlDevice.GetControl(InControl.InputControlType.LeftStickY).RawValue; LeftAnalogStrafeAxis = inControlDevice.GetControl(InControl.InputControlType.LeftStickX).RawValue; RightAnalogXAxis = inControlDevice.GetControl(InControl.InputControlType.RightStickX).RawValue; RightAnalogYAxis = inControlDevice.GetControl(InControl.InputControlType.RightStickY).RawValue; DashDown = (inControlDevice.GetControl(InControl.InputControlType.RightBumper).IsPressed); DashPressed = (inControlDevice.GetControl(InControl.InputControlType.RightBumper).WasPressed); PauseDown = inControlDevice.GetControl(InControl.InputControlType.Start).IsPressed; PausePressed = inControlDevice.GetControl(InControl.InputControlType.Start).WasPressed; AttackSphereDown = (inControlDevice.GetControl(InControl.InputControlType.LeftBumper).IsPressed); AttackSpherePressed = (inControlDevice.GetControl(InControl.InputControlType.LeftBumper).WasPressed); AttackSphereReleased = (inControlDevice.GetControl(InControl.InputControlType.LeftBumper).WasReleased); if (INPUTS_TABLE_DEBUG) { Debug.Log("------------ INPUT DEBUG ------------"); Debug.Log("LeftAnalogForwardAxis : " + LeftAnalogForwardAxis); Debug.Log("LeftAnalogStrafeAxis : " + LeftAnalogStrafeAxis); //Debug.Log("RightAnalogXAxis : " + RightAnalogXAxis); //Debug.Log("RightAnalogYAxis : " + RightAnalogYAxis); //Debug.Log("Dash : " + Dash); //Debug.Log("Pause : " + Pause); } } }
// Check for pause and select button press void Update() { InControl.InputDevice input = InControl.InputManager.ActiveDevice; if ((Input.GetKeyDown(KeyCode.Escape) || input.GetControl(InControl.InputControlType.Start)) && m_state.Peek() == State.InGame) { m_state.Push(State.Pause); m_inGameUI.SetActive(false); m_pauseMenuUI.SetActive(true); m_pauseMenuUI.GetComponentInChildren <Button>().Select();//Set selected (random first button) Pause(); } else if ((Input.GetKeyDown(KeyCode.Tab) || input.GetControl(InControl.InputControlType.Select) || input.GetControl(InControl.InputControlType.DPadDown)) && m_state.Peek() == State.InGame) { m_state.Push(State.Upgrades); m_inGameUI.SetActive(false); m_mutagenMenuUI.SetActive(true); m_mutagenMenuUI.GetComponentInChildren <Button>().Select();//Set selected (random first button) Pause(); } else if ((Input.GetKeyDown(KeyCode.Escape) || input.GetControl(InControl.InputControlType.Action2)) && (m_state.Peek() == State.Upgrades || m_state.Peek() == State.Settings || m_state.Peek() == State.Pause)) { m_state.Pop(); //Out of upgrades/options to inGame if (m_state.Peek() == State.Title) { m_titleMenuUI.SetActive(true); m_settingsUI.SetActive(false); } else if (m_state.Peek() == State.Pause) { m_pauseMenuUI.SetActive(true); m_settingsUI.SetActive(false); } else { m_inGameUI.SetActive(true); //set all possibilities to false m_mutagenMenuUI.SetActive(false); m_scrapMenuUI.SetActive(false); m_pauseMenuUI.SetActive(false); m_settingsUI.SetActive(false); //Unpause UnPause(); } } else if ((Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.A) || input.GetControl(InControl.InputControlType.LeftBumper) || input.GetControl(InControl.InputControlType.RightBumper)) && !m_menuSwitch && m_state.Peek() == State.Upgrades) { m_menuSwitch = true; ScrapMutaMenuToggle(); } else if (!input.GetControl(InControl.InputControlType.LeftBumper) && !input.GetControl(InControl.InputControlType.RightBumper) && m_menuSwitch) { m_menuSwitch = false; } if (m_state.Peek() == State.InGame) { m_timer += Time.deltaTime; } }
bool IsPressed( InputControlType control, InputDevice device ) { return IsPressed( device.GetControl( control ) ); }
// Update is called once per frame void Update() { InControl.InputDevice input = InControl.InputManager.ActiveDevice; //Input //Works with both WASD and Left joystick Vector3 move = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")) * m_speed; if (move.sqrMagnitude >= m_speed * m_speed) { move = move.normalized * m_speed; } //No controller //if (input == InControl.InputDevice.Null) { transform.LookAt(GetMouseToPlayerPlanePoint()); //look at mouse //} //Joystick if (input.GetControl(InControl.InputControlType.RightStickX) != 0 || input.GetControl(InControl.InputControlType.RightStickY) != 0) { float heading = Mathf.Atan2(input.GetControl(InControl.InputControlType.RightStickX), input.GetControl(InControl.InputControlType.RightStickY)) * Mathf.Rad2Deg; transform.rotation = Quaternion.Euler(0f, heading, 0f); } else { } //Moving back or forward for animation blending EXPAND to side ways as well if (Vector3.Dot(transform.forward, move) < 0) { m_animator.SetFloat("Speed", -move.magnitude / m_speed);//Backwards } else { m_animator.SetFloat("Speed", move.magnitude / m_speed); } //Keep grounded if (!m_controller.isGrounded) { //fall move.y += Physics.gravity.y * 10 * Time.deltaTime; } else { move.y = 0; } //Move using controller m_controller.Move(move * Time.deltaTime); //Range shoot input. only will do another action if in Movement (not doing other actions) if (m_animator.GetCurrentAnimatorStateInfo(1).IsName("UpperBody.Movement")) { if ((input.GetControl(InControl.InputControlType.LeftTrigger) > 0 || Input.GetMouseButtonDown(0)) && m_rangeTimer >= m_rangeCooldown && m_bulletPrefabs.Count > 0 && m_bulletExitPos != null) { m_animator.SetTrigger("Shoot"); HideMelee(); ShowRange(); //CreateBullet();//Animator now calls it m_rangeTimer = 0; }//Melee else if ((input.GetControl(InControl.InputControlType.RightTrigger) > 0 || Input.GetMouseButtonDown(1)) && m_meleeTimer >= m_meleeCooldown) { m_animator.SetTrigger("Melee"); //Hit check Animator calls the function now // MeleeSwing(); //Set timer to 0 m_meleeTimer = 0; } else if ((input.GetControl(InControl.InputControlType.LeftBumper).IsPressed || Input.GetKeyDown(KeyCode.Q)) && m_blockTimer >= m_blockCooldown) { //Blocking GameObject spawn = Instantiate <GameObject>(m_defEffPrefab, transform.position, transform.rotation); spawn.GetComponent <EffectDestroy>().m_duration = m_blockDuration; spawn.transform.parent = this.transform; m_animator.SetTrigger("Block"); m_incomeDamMod -= m_blockChange; //drop the mod m_blockCounter = 0.01f; //Counts up to duration MATCH WITH ANIMATION? m_blockTimer = 0; //Cooldown } else if ((input.GetControl(InControl.InputControlType.RightBumper).IsPressed || Input.GetKeyDown(KeyCode.E)) && GameManager.Instance.MutaGenAmount() > m_healCost && m_healTimer > m_healCooldown) { //Heal GameObject spawn = Instantiate <GameObject>(m_healEffPrefab, transform.position, transform.rotation); spawn.GetComponent <EffectDestroy>().m_duration = 1.0f; spawn.transform.parent = this.transform; IncreaseCurrentHP(m_healAmount); GameManager.Instance.ChangeMutaGen(-m_healCost); m_healTimer = 0; //Create glow or something? } else if ((input.GetControl(InControl.InputControlType.Action4) || Input.GetAxis("Mouse ScrollWheel") != 0 || Input.GetKeyDown(KeyCode.R))) { //Cycle through weapons m_bulletIndex++; if (m_bulletIndex >= m_bulletPrefabs.Count) { m_bulletIndex = 0; //Cycle } } } Debug.Log(m_animator.GetCurrentAnimatorStateInfo(1).IsName("UpperBody.Movement")); //Timers if (m_rangeTimer < m_rangeCooldown) { m_rangeTimer += Time.deltaTime; } if (m_meleeTimer < m_meleeCooldown) { m_meleeTimer += Time.deltaTime; } if (m_blockTimer < m_blockCooldown) { m_blockTimer += Time.deltaTime; } //If not 0 increase until hits duration if (m_blockCounter > 0 && m_blockCounter < m_blockDuration) { m_blockCounter += Time.deltaTime; } //If its out of duration set block damage back to normal if (m_blockCounter >= m_blockDuration) { m_incomeDamMod += m_blockChange;//reset modifier m_blockCounter = 0.0f; } if (m_healTimer < m_healCooldown) { m_healTimer += Time.deltaTime; } }
bool IsPressed(InputControlType control, InputDevice device) { return(device.GetControl(control).IsPressed); }
void refreshControls() { idevice = InputManager.ActiveDevice; ctrl_Jump = idevice.GetControl(InputControlType.Action1); ctrl_LeftStickX = idevice.GetControl(InputControlType.LeftStickX); ctrl_LeftStickY = idevice.GetControl(InputControlType.LeftStickY); ctrl_Select = idevice.GetControl(InputControlType.Select); ctrl_Start = idevice.GetControl(InputControlType.Start); ctrl_RightBumper = idevice.GetControl(InputControlType.RightBumper); ctrl_RightJoystickButton = idevice.GetControl(InputControlType.RightStickButton); ctrl_O = idevice.GetControl(InputControlType.Action2); }