private void Control() { if (Gamecontroller.TotalLife > 0 && !Gamecontroller.GameEnd) {//eixos de movimento Movement.x = SimpleInput.GetAxis("Horizontal"); Movement.z = SimpleInput.GetAxis("Vertical"); IsGrounded = Physics.CheckSphere(Feet.position, GroundDistance, GroundLayer, QueryTriggerInteraction.Ignore); SpeedY = Body.velocity.y; //verifica o input dos botões, para funcionar com controles também if (SimpleInput.GetButtonDown("Jump")) { Jumping(); } if (SimpleInput.GetButtonDown("Fire1")) { Atacking(); } if (SimpleInput.GetButtonDown("Fire2")) { Masking(); } if (SimpleInput.GetButtonDown("Fire3")) { Rescuing(); } } }
public HttpResponseMessage Server3AccessStep1(SimpleInput Input) { // We need try - catch block here to detect whether the decryption of message went successfully // Decrypt() method throws an exception if it can't decrypt a message string Result = null; try { //Check if KhalafServer is asking for an access if (Input.Value.DecryptText(ConfigurationManager.AppSettings["KeyMerchantA"]) == ConfigurationManager.AppSettings["MerchantAServerID"]) { Result = JsonConvert.SerializeObject( new { Message1 = Guid.NewGuid().ToString(), Message2 = Guid.NewGuid().ToString().EncryptText(ConfigurationManager.AppSettings["KeyNCDC"]) } , Formatting.None).EncryptText(ConfigurationManager.AppSettings["KeyMerchantA"]); } } catch { } if (Result == null) { return(Request.CreateResponse(HttpStatusCode.Forbidden)); } else { return(Request.CreateResponse(HttpStatusCode.OK, Result)); } }
private void Update() { if (Input.GetButtonDown(menuButtonName) && inputController.input.held == false) { if (paused == PauseManager.Instance.Paused) { paused = !paused; PauseManager.Instance.Paused = paused; InventoryManager.Instance.ShowInventory(paused); } } if (PauseManager.Instance != null && PauseManager.Instance.Paused) { return; } // creats new vector 2 out of input axis inputController.joystick = new Vector2(SimpleInput.GetAxisRaw(horizontalAxisName), SimpleInput.GetAxisRaw(verticalAxisName)); // if magnitude greater than 1, the input needs normalized so you can't move faster diagnal. if (inputController.joystick.magnitude > 1) { inputController.joystick.Normalize(); } // check for input button presses. inputController.input.Evaluate(inputButtonName); inputController.interact.Evaluate(interactButtonName); inputController.dodge.Evaluate(dodgeButtonName); }
private void Update() { if (!m_Jump) { m_Jump = SimpleInput.GetButtonDown("Jump"); } }
// Fixed update is called in sync with physics private void FixedUpdate() { // read inputs float h = SimpleInput.GetAxis("Horizontal"); float v = SimpleInput.GetAxis("Vertical"); // calculate move direction to pass to character if (m_Cam != null) { // calculate camera relative direction to move: m_CamForward = Vector3.Scale(m_Cam.forward, new Vector3(1, 0, 1)).normalized; m_Move = v * m_CamForward + h * m_Cam.right; } else { // we use world-relative directions in the case of no main camera m_Move = v * Vector3.forward + h * Vector3.right; } #if !MOBILE_INPUT // walk speed multiplier if (Input.GetKey(KeyCode.LeftShift)) { m_Move *= 0.5f; } #endif // pass all parameters to the character control script m_Character.Move(m_Move, m_Jump); m_Jump = false; }
void Update() { if (SimpleInput.GetButtonDown("attack") | Input.GetKeyDown(KeyCode.Space) && PlayerState == PlayerStates.Strange) { PlayerState = PlayerStates.Reload; Strange = StrangeMin; ThrowSnowball(); attackTimer = AttackInterval; } if (PlayerState == PlayerStates.Strange) { StrangeLerp(); TrajectoryRender(); } else { attackTimer -= Time.deltaTime; if (attackTimer <= 0) { PlayerState = PlayerStates.Strange; } } MoveUpdate(); AnimationUpdate(); }
private void FixedUpdate() { xPos = SimpleInput.GetAxisRaw("Horizontal"); /*Mobile Touch Sensor * if (touch_pos.x > 0 && Input.touchCount>0) * { * xPos = 1; * rb.MovePosition(rb.position + Vector2.right * xPos * Speed * Time.fixedDeltaTime); * } * else if (touch_pos.x < 0 && Input.touchCount > 0) * { * xPos = -1; * rb.MovePosition(rb.position + Vector2.right * xPos * Speed * Time.fixedDeltaTime); * } * else * { * xPos = 0; * rb.MovePosition(rb.position + Vector2.right * xPos * Speed * Time.fixedDeltaTime); * } */ rb.MovePosition(rb.position + Vector2.right * xPos * Speed * Time.fixedDeltaTime); }
private void GetInput(out float speed) { // Read input float horizontal = SimpleInput.GetAxis("Horizontal"); float vertical = SimpleInput.GetAxis("Vertical"); bool waswalking = m_IsWalking; #if !MOBILE_INPUT // On standalone builds, walk/run speed is modified by a key press. // keep track of whether or not the character is walking or running m_IsWalking = !Input.GetKey(KeyCode.LeftShift); #endif // set the desired speed to be walking or running speed = m_IsWalking ? m_WalkSpeed : m_RunSpeed; m_Input = new Vector2(horizontal, vertical); // normalize input if it exceeds 1 in combined length: if (m_Input.sqrMagnitude > 1) { m_Input.Normalize(); } // handle speed change to give an fov kick // only if the player is going to a run, is running and the fovkick is to be used if (m_IsWalking != waswalking && m_UseFovKick && m_CharacterController.velocity.sqrMagnitude > 0) { StopAllCoroutines(); StartCoroutine(!m_IsWalking ? m_FovKick.FOVKickUp() : m_FovKick.FOVKickDown()); } }
protected void Update() { if (SimpleInput.GetButtonDown("Reset Camera") && m_ResetTurnSpeed > 0) { isResettingCamera = true; } }
public HttpResponseMessage DoSomeJob(SimpleInput Input) { int?Result = null; // We need try - catch block here to detect whether the decryption of message went successfully // Decrypt() method throws an exception if it can't decrypt a message try { // Decrypting AccessKey and checking for expiration if (Convert.ToDateTime(Input.Value.DecryptText(ConfigurationManager.AppSettings["KeyMCI"])) > DateTime.Now) { Result = 5 + 5; } } catch { } if (Result == null) { return(Request.CreateResponse(HttpStatusCode.Forbidden)); } else { return(Request.CreateResponse(HttpStatusCode.OK, Result)); } }
/* * <div class="btn-group btn-group-toggle" data-toggle="buttons"> * <label class="btn btn-secondary active"> * <input type="radio" name="options" id="option1" autocomplete="off" checked> Active * </label> * <label class="btn btn-secondary"> * <input type="radio" name="options" id="option2" autocomplete="off"> Radio * </label> * <label class="btn btn-secondary"> * <input type="radio" name="options" id="option3" autocomplete="off"> Radio * </label> * </div> */ public void AddRadioButton(string buttonText, bool pressedState) { if (_hasActiveRadioButton == true && pressedState == true) { throw new ArgumentException("Es darf nur ein RadioButton gedrückt sein", nameof(pressedState)); } _hasActiveRadioButton |= pressedState; Label label = new Label { ClassName = "btn btn-secondary" + (pressedState ? " active" : "") }; SimpleInput input = new SimpleInput(); input.SetAttribute("type", "radio"); input.SetAttribute("name", "options"); input.SetAttribute("autocomplete", "off"); if (pressedState) { input.SetAttribute("checked", ""); } label.Text = buttonText; label.AppendChild(input); AppendChild(label); }
public HttpResponseMessage GetAccess(SimpleInput Input) { string Result = null; // We need try - catch block here to detect whether the decryption of message went successfully // Decrypt() method throws an exception if it can't decrypt a message try { // Decrypting message received from Khalaf Server var DecryptedMessage = Input.Value.DecryptText(ConfigurationManager.AppSettings["KeyMCI"]); // 5 minute access key Result = DateTime.Now.AddMinutes(5).ToString().EncryptText(ConfigurationManager.AppSettings["KeyMCI"]); } catch { } if (Result == null) { return(Request.CreateResponse(HttpStatusCode.Forbidden)); } else { return(Request.CreateResponse(HttpStatusCode.OK, Result)); } }
//physics in fixed update void FixedUpdate() { //true of false did the ground transform hit the whatIsGround with the groundRadius grounded = Physics2D.OverlapCircle(groundCheck.position, groundRadius, whatIsGround); //tell the animator that we are grounded anim.SetBool("Ground", grounded); //get how fast we are moving up or down form the rigidbody anim.SetFloat("vSpeed", GetComponent <Rigidbody2D>().velocity.y); //get move direction float move = SimpleInput.GetAxis("Horizontal"); // add velocity to the rigidbody in the move direction* ourspeed GetComponent <Rigidbody2D>().velocity = new Vector2(move * topSpeed, GetComponent <Rigidbody2D>().velocity.y); anim.SetFloat("Speed", Mathf.Abs(move)); //if we're face the negtive direction and not faceing right , flip if (move > 0 && !facingRight) { Flip(); } else if (move < 0 && facingRight) { Flip(); } }
private void Update() { if (_choosingDirection) { if (_directionSelectorChanged) { if (SimpleInput.GetAxisRaw("Horizontal") > 0.5f && _availableNeighbours[0] != null) { SelectDirection(0); } if (SimpleInput.GetAxisRaw("Vertical") > 0.5f && _availableNeighbours[1] != null) { SelectDirection(1); } if (SimpleInput.GetAxisRaw("Horizontal") < -0.5f && _availableNeighbours[2] != null) { SelectDirection(2); } if (SimpleInput.GetAxisRaw("Vertical") < -0.5f && _availableNeighbours[3] != null) { SelectDirection(3); } } //this occurs when the directionSelector combination is repeated, so the player don't have to insert inputs per each tile that are adjacents else { _choosingDirection = false; _clsPlayerSpriteManager.directionSelector.SetActive(false); SetTargetFloor(_availableNeighbours[_currentDirection]); } } }
void FixedUpdate() { //if (grounded) move = SimpleInput.GetAxis("Horizontal"); //else // move = jumpMove; anim.SetFloat("Speed", Mathf.Abs(move)); anim.SetBool("Ground", grounded); anim.SetFloat("vSpeed", pRigidBody.velocity.y); anim.SetBool("Damaged", damaged); if (!damaged && hp > 0) { pRigidBody.velocity = new Vector2(move * maxSpeed, pRigidBody.velocity.y); } if (move > 0 && !facingRight) { Flip(); } else if (move < 0 && facingRight) { Flip(); } if (jump) { pRigidBody.AddForce(new Vector2(0f, jumpForce)); audioSource.clip = jumpSound; audioSource.Play(); jump = false; } }
private void Move() { PlayerManager _player = GetComponent <PlayerManager>(); if (_player.isDead) { this.transform.position = this.transform.position + new Vector3(movement.x, movement.y, 0f).normalized * 0.25f; return; } float _xAxis = SimpleInput.GetAxisRaw("Horizontal"); float _yAxis = SimpleInput.GetAxisRaw("Vertical"); Vector2 _movementInput = new Vector2(_xAxis, _yAxis); if (_movementInput.magnitude == 0f && !isAI) { return; } for (int i = 0; i < rigidPoint.Length - 1; i++) { if (Vector2.Dot(rigidPoint[i].velocity, movement) != 1 && Vector2.Dot(rigidPoint[i].velocity, movement) != 0f) { rigidPoint[i].velocity = Vector2.zero; } if (rigidPoint[i].velocity.magnitude <= maxVelocity || (isFast && rigidPoint[i].velocity.magnitude <= maxVelocity * 2f)) { rigidPoint[i].AddForce(movement, ForceMode2D.Impulse); } } }
// Update is called once per fixed time delta void FixedUpdate() { /* * This is from Joystic of standard assest * var moveRequest = CrossPlatformInputManager.GetAxis("Horizontal"); * var jumpRequest = CrossPlatformInputManager.GetAxis("Vertical"); */ // this is from Joystick from SimpleInput system var moveRequest = SimpleInput.GetAxis("Horizontal"); var jumpRequest = SimpleInput.GetAxis("Vertical"); if (playerMoveScript != null && playerMoveScript.isActiveAndEnabled) { playerMoveScript.Move(moveRequest); } if (playerJumpScript != null && playerJumpScript.isActiveAndEnabled) { playerJumpScript.Jump(jumpRequest); } if (playerJetJumpScript != null && playerJetJumpScript.isActiveAndEnabled) { playerJetJumpScript.Jump(jumpRequest); } if (playerFlyScript != null && playerFlyScript.isActiveAndEnabled) { playerFlyScript.Fly(moveRequest, jumpRequest); } }
void InputUpdate() { if (SimpleInput.GetButtonUp("pause") | Input.GetKeyDown(KeyCode.Return)) { Time.timeScale = 0; PausePanel.SetActive(true); Pause_Score.text = GameController.singltone.Score.ToString(); B_Pause.gameObject.SetActive(false); } if (SimpleInput.GetButtonUp("return") | Input.GetKeyDown(KeyCode.Return)) { Time.timeScale = 1; PausePanel.SetActive(false); B_Pause.gameObject.SetActive(true); } if (SimpleInput.GetButtonUp("restart")) { GameController.singltone.NewGame(); Time.timeScale = 1; PausePanel.SetActive(false); GameOverPanel.SetActive(false); WinGamePanel.SetActive(false); B_Pause.gameObject.SetActive(true); timer = 0; } }
private void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player")) { cam.TxtAction.text = comName; float points = PointsSystem.categories[categoryName].Points; float total = PointsSystem.categories[categoryName].Total; if (!StaticClass.disableInput && SimpleInput.GetButtonDown("Fire1")) { if (points >= total * seuil - 0.1) { cam.TxtDialog.text = "Félicitation ! Vous avez changé vos notes à l'insu du doyen. Nouvelle moyenne : 6.0"; } else { cam.TxtDialog.text = "Vous devez avoir au minimum " + total * seuil + " points dans le domaine " + categoryName + " pour utiliser cettre compétence."; } cam.TxtDialog.transform.parent.gameObject.SetActive(true); StaticClass.disableInput = true; } else if (StaticClass.disableInput && (SimpleInput.GetButtonDown("Fire1") || SimpleInput.GetButtonDown("Touch anywhere"))) { Camera.main.GetComponent <CameraScript>().TxtAction.text = string.Empty; cam.TxtDialog.transform.parent.gameObject.SetActive(false); StaticClass.disableInput = false; } } }
public void LookRotation(Transform character, Transform camera) { float yRot = SimpleInput.GetAxis("mouseX") * XSensitivity; float xRot = SimpleInput.GetAxis("mouseY") * YSensitivity; m_CharacterTargetRot *= Quaternion.Euler(0f, yRot, 0f); m_CameraTargetRot *= Quaternion.Euler(-xRot, 0f, 0f); if (clampVerticalRotation) { m_CameraTargetRot = ClampRotationAroundXAxis(m_CameraTargetRot); } if (smooth) { character.localRotation = Quaternion.Slerp(character.localRotation, m_CharacterTargetRot, smoothTime * Time.deltaTime); camera.localRotation = Quaternion.Slerp(camera.localRotation, m_CameraTargetRot, smoothTime * Time.deltaTime); } else { character.localRotation = m_CharacterTargetRot; camera.localRotation = m_CameraTargetRot; } UpdateCursorLock(); }
private void TankUpdate() { float v = SimpleInput.GetAxis("Vertical"); float h = SimpleInput.GetAxis("Horizontal"); bool walk = SimpleInput.GetKey(KeyCode.LeftShift); if (v < 0) { if (walk) { v *= m_backwardsWalkScale; } else { v *= m_backwardRunScale; } } else if (walk) { v *= m_walkScale; } m_currentV = Mathf.Lerp(m_currentV, v, Time.deltaTime * m_interpolation); m_currentH = Mathf.Lerp(m_currentH, h, Time.deltaTime * m_interpolation); transform.position += transform.forward * m_currentV * m_moveSpeed * Time.deltaTime; transform.Rotate(0, m_currentH * m_turnSpeed * Time.deltaTime, 0); m_animator.SetFloat("MoveSpeed", m_currentV); JumpingAndLanding(); }
private void Update() { if (!m_jumpInput && SimpleInput.GetKey(KeyCode.Space)) { m_jumpInput = true; } }
private void Update() { if (_timeOfFirePress > 0) { if (IsFirePressed) { if (CurrentFireHoldTime >= kMaxFireHoldTime) { OnFirePressedEnd(); } } else { OnFirePressedEnd(); } } if (Input.anyKey) { float inputHorizontal = SimpleInput.GetAxis(HorizontalAxis); float inputVertical = SimpleInput.GetAxis(verticalAxis); Vector2 directional = new Vector2(inputHorizontal, inputVertical); directional = Vector2.ClampMagnitude(directional, 1); Move.SafeRaise(directional); if (IsFirePressed && _timeOfFirePress == 0) { //_timeOfFirePress = Time.timeSinceLevelLoad; Fire.SafeRaise(GetFireDirection(), 2f); } } }
void Update() { isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask); if (isGrounded && velocity.y < 0) { velocity.y = -2f; } /* //commented in p5 * float x = Input.GetAxis("Horizontal"); * float z = Input.GetAxis("Vertical"); */ //new for p5 float x = SimpleInput.GetAxis("Horizontal"); float z = SimpleInput.GetAxis("Vertical"); Vector3 move = transform.right * x + transform.forward * z; controller.Move(move * speed * Time.deltaTime); //used for 'Jump' method in line19 if (Input.GetButtonDown("Jump") && isGrounded) { velocity.y = Mathf.Sqrt(jumpHeight * -2 * gravity); } velocity.y += gravity * Time.deltaTime; controller.Move(velocity * Time.deltaTime); }
public void Move() { _movement = SimpleInput.GetAxis("Horizontal"); _rb.velocity = new Vector2(_movement * _speed, _rb.velocity.y); ButtonLeft.localScale = new Vector2(1.7f, 1.7f); ButtonRight.localScale = new Vector2(1.7f, 1.7f); if (_movement != 0) { if (!_currentState.Equals("jump_idle")) { SetCharacterState("run"); } if (_movement > 0) { transform.localScale = new Vector3(0.7f, 0.7f); ButtonRight.localScale = new Vector2(1.63f, 1.63f); isRotate = 1; } else { transform.localScale = new Vector3(-0.7f, 0.7f); ButtonLeft.localScale = new Vector2(1.63f, 1.63f); isRotate = -1; } } else { if (!_currentState.Equals("jump_idle")) { SetCharacterState("Idle"); } } }
void FixedUpdate() { if (instance.currState == GameManager.gameState.playing) { // Movement if (SimpleInput.GetAxisRaw("Horizontal") > 0) { this.Clockwise.Execute(this.gameObject); Animation.SetBool("Running", true); } else if (SimpleInput.GetAxisRaw("Horizontal") < 0) { this.CounterClockwise.Execute(this.gameObject); Animation.SetBool("Running", true); } // Battle if (SimpleInput.GetButton("Jump")) { this.Shoot.Execute(this.gameObject); this.GetComponent <AudioSource>().Play(); } if (SimpleInput.GetAxisRaw("Horizontal") == 0) { Animation.SetBool("Running", false); } } }
void Update() { if (SimpleInput.GetAxis("Horizontal") != 0 || SimpleInput.GetAxis("Vertical") != 0) { SendMovementInfo(SimpleInput.GetAxis("Horizontal"), SimpleInput.GetAxis("Vertical")); if (Mathf.Abs(SimpleInput.GetAxis("Horizontal")) > 0.85f || Mathf.Abs(SimpleInput.GetAxis("Vertical")) > 0.85f) { SendBoostInfo(1); } else { SendBoostInfo(0); } } if (SimpleInput.GetButton("Fire")) { SendShootingInfo(); } if (SimpleInput.GetButtonDown("Powerup")) { SendPowerupInfo(); } //if (SimpleInput.GetButton("Boost")) //{ // SendBoostInfo(1); //} else if (SimpleInput.GetButtonUp("Boost")) //{ // SendBoostInfo(0); //} }
public void CheckInput() { movementInputDirection = Mathf.RoundToInt(SimpleInput.GetAxisRaw("Horizontal")); if (movementInputDirection == facingDirection && isTouchingWall) { if (!isGrounded && movementInputDirection != facingDirection) { canMove = false; canFilp = false; turnTimer = turnTimerSet; } amountOfJumpsLeft = amountOfJump + 1; } if (!canMove) { turnTimer -= Time.deltaTime; if (turnTimer <= 0) { canMove = true; canFilp = true; } } }
private void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player") && SimpleInput.GetButton("Fire1") && elevatorDoor.level == elevatorDoor.elevator.currentLevel && elevatorDoor.elevator.currentLevel == elevatorDoor.elevator.destinationLevel) { elevatorDoor.open = true; } }
protected override void Movement() { int horizontal = 0; int vertical = 0; if (SimpleInput.GetAxisRaw("Horizontal") > 0.5f) { horizontal = 1; } else if (SimpleInput.GetAxisRaw("Horizontal") < -0.5f) { horizontal = -1; } if (SimpleInput.GetAxisRaw("Vertical") > 0.5f) { vertical = 1; } else if (SimpleInput.GetAxisRaw("Vertical") < -0.5f) { vertical = -1; } if (horizontal != 0 || vertical != 0) { Move(horizontal, vertical); } }
private void button3_Click(object sender, EventArgs e) { int inputNodeCount, hiddenLayerCount, outputNodeCount; SimpleInput inputDialog = new SimpleInput(); inputNodeCount = inputDialog.Prompt("Please enter the number of input nodes (1-4).", "Input Nodes", 4); hiddenLayerCount = inputDialog.Prompt("Please enter the number of hidden layers (1-3).", "Hidden Layers", 3); outputNodeCount = inputDialog.Prompt("Please enter the number of output nodes (1-4).", "Output Nodes", 4); Double[] inputValues = new Double[inputNodeCount]; Random random = new Random(); for (int i = 0; i < inputNodeCount; i++) { inputValues[i] = random.NextDouble(); } myNeuralNet = new NeuralNet(inputValues, hiddenLayerCount, outputNodeCount, new int[] { 650, 480 }); updateNN(); lstNode.Items.Clear(); for (int i = 1; i <= inputNodes.Length; i++) { lstNode.Items.Add("Node " + i.ToString()); } Application.DoEvents(); }
public Task get_events_simple(SimpleInput input) { return _writer.Write(input); }