////////////////////////////////////////////////////////////////////////////// #region Input private void UpdateInput(float delta) { if (m_input.IsActive) { m_input.Update(delta); } if (!GetField().IsGameDumbMuliplayerClient || IsNetworkPlayer) { for (int i = 0; i < ACTIONS.Length; ++i) { PlayerAction action = ACTIONS[i]; if (m_input.IsActionJustPressed(action)) { OnActionPressed(m_input, action); } } for (int i = 0; i < ACTIONS.Length; ++i) { PlayerAction action = ACTIONS[i]; if (m_input.IsActionJustReleased(action)) { OnActionReleased(m_input, action); } } } }
protected void Update() { if (_stateManager.GetState() != State.Play && _activateControllerDebug == false) { return; } PlayerInput input; PlayerInput.Update(out input); if (input.move.y < 0f) { input.look.y = -input.look.y; } if (playerCharacter) { playerCharacter.Simulate(characterController, input); } if (_cameraAnimationInProgress == false) { FocusObjectUpdate(); } if (_lookingAtCat == true && _currentCatInFocus != null) { if (Input.GetKeyDown(KeyCode.E)) { _currentCatInFocus.ActivatePet(); } } }
protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } base.Update(gameTime); float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds; PlayerInput.Update(deltaTime); if (GUIMessageBox.VisibleBox != null) { GUIComponent.ForceMouseOn(GUIMessageBox.VisibleBox); GUIMessageBox.VisibleBox.Update(deltaTime); return; } GUIComponent.ClearUpdateList(); guiRoot.AddToGUIUpdateList(); GUIComponent.UpdateMouseOn(); guiRoot.Update(deltaTime); }
// Update is called once per frame void Update() { if (inputLocked) { curInputLockTime += Time.deltaTime; if (curInputLockTime >= inputLockTime) { inputLocked = false; } } lockAirborneMovementTime -= Time.deltaTime; playerInput.Update(); fsm.TickCurrentState(); animationManager.Update(); CheckForCollectibles(); UpdateScale(); if (!didWin && !didDie) { CheckForWin(); } if (!didWin && !didDie) { CheckForSpikes(); } }
public void PlayerInputUpdateTest() { GameObject toTest = CreateGameObjectWithPlayerInput(); PlayerInput playerInput = toTest.GetComponent <PlayerInput>(); playerInput.Update(); }
protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } GUI.ClearUpdateList(); if (settings.AutoCheckUpdates) { if (updateCheckState == 0) { updateInfoText.Text = "Checking for updates..."; updateCheckState++; } else if (updateCheckState == 2) { CheckForUpdates(); updateCheckState++; } } base.Update(gameTime); float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds; PlayerInput.Update(deltaTime); guiRoot.AddToGUIUpdateList(); GUI.Update(deltaTime); }
private void Update() { PlayerInput.Update(); rb.mass = mass; if (PlayerInput.isCrouching) { Crouch(); } else { Uncrouch(); } if (PlayerInput.isSprinting && isGrounded && !PlayerInput.isCrouching) { Sprint(); } else if (isGrounded) { Walk(); } if (PlayerInput.isJumping && !PlayerInput.isCrouching) { Jump(); } }
private void Update() { input.Update(); //anim.ResetTrigger("moveLeft"); //anim.ResetTrigger("moveRight"); playerModel.Update(); transform.position = playerModel.Position; }
void Update() { PlayerInput.Update(); // TODO : This belongs somewhere else! isGrounded = IsGrounded; CheckInput(); Accelerate(); ApplyVelocity(); Deaccelerate(); ApplyGravity(); }
private void Update() { //Get input here and queue it up to be processed by FixedUpdate- can't get in FixedUpdate since it may miss inputs input.Update(this); CheckRollTrail(); //TODO replace this with unity animator stuff AdvanceAnim(); sr.sprite = GetAnimSprite(); }
private void Update() { if (playerInput != null) { playerInput.Update(); } else { Debug.LogError("Player Input Not Assigned"); } }
void Update() { if (Input.GetKeyDown(KeyCode.R)) { transform.position = Vector3.zero; } input.Update(); FlipSprite(); UpdateMovement(); animator.SetBool("wall_slide", wallSliding); }
private void FixedUpdate() { input.Update(); UpdateStates(); Movement(); if (input.b_LMB || input.b_RMB) { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; } }
void Update() { lockAirborneMovementTime -= Time.deltaTime; playerInput.Update(); fsm.TickCurrentState(); animationManager.Update(); if (!fsm.currentState.IsDead() && spikeDetector.IsTouching()) { DieAndRestartScene(); } transform.localScale = new Vector3(IsFacingDefaultDirection() ? 1f : -1f, 1f, 1f); }
/// <summary> /// Allows each screen to run logic. /// </summary> public override void Update(GameTime gameTime) { // Read the keyboard and gamepad. //might not be needed input.Update(); // Make a copy of the master screen list, to avoid confusion if // the process of updating one screen adds or removes others. screensToUpdate.Clear(); foreach (GameScreen screen in screens) screensToUpdate.Add(screen); bool otherScreenHasFocus = !Game.IsActive; bool coveredByOtherScreen = false; // Loop as long as there are screens waiting to be updated. while (screensToUpdate.Count > 0) { // Pop the topmost screen off the waiting list. GameScreen screen = screensToUpdate[screensToUpdate.Count - 1]; screensToUpdate.RemoveAt(screensToUpdate.Count - 1); // Update the screen. screen.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); if (screen.ScreenState == ScreenState.TransitionOn || screen.ScreenState == ScreenState.Active) { // If this is the first active screen we came across, // give it a chance to handle input. if (!otherScreenHasFocus) { screen.HandleInput(input); otherScreenHasFocus = true; } // If this is an active non-popup, inform any subsequent // screens that they are covered by it. if (!screen.IsPopup) coveredByOtherScreen = true; } } // Print debug trace? if (traceEnabled) TraceScreens(); }
protected override void Update() { if (KeyboardInput.IsKeyDownOnce(Key.F1)) { //TextureLoader.Dispose(); GraphicsDeviceManager.ToggleFullScreen(); } if (KeyboardInput.IsPressed(Key.Escape)) { Exit(); } PlayerInput.Update(); //GameWorld.Update(); }
// Update is called once per frame void Update() { if (!HasStart && effect.GetHasStart()) { HasStart = true; } if (!EnableMove) { return; } playerInput.Update(); Shot(); Dodge(); }
void Update() { #if UNITY_EDITOR //if (GetComponent<PolygonCollider2D>().enabled) // GetComponent<PolygonCollider2D>().enabled = false; if (Input.GetKeyDown(KeyCode.A)) { dodge.DodgeAttack(); } #endif playerInput.Update(); //PlayDodgegGaugeMaxSe(); if (Input.GetKeyDown(KeyCode.P)) { Time.timeScale = 0; playerInput.DisableInput(); } if (Input.GetKeyDown(KeyCode.O)) { Time.timeScale = 1; playerInput.EnableInput(); } //回避 if (enableDodge && playerInput.TouchTime >= stageManager.GetPressTimeNeed() && playerInput.HasReleased) { dodge.DodgeAttack(); SoundManager.Instance.PlaySe(SE.DodgeAttack); } if (hasMissileItem) { return; } //弾を撃つ if (playerInput.SameTimeTapBegin) { SoundManager.Instance.PlaySe(SE.ShotBegin); } if (playerInput.SameTimeTap) { shot.ShotBullet(); } }
void Update() { PlayerInput.Update(); CheckChangeWeaponInput(); switch (State) { case PlayerState.EMPTY: HandleEmpty(); break; case PlayerState.CARRY: HandleCarrying(); break; case PlayerState.INTERACT: HandleInteracting(); break; case PlayerState.GRAB: HandleGrabbing(); break; case PlayerState.ATTACK: HandleAttacking(); break; } }
void Update() { PlayerInformation.Position = new Vector3(transf.position.x, transf.position.y, transf.position.y / 40); transf.position = PlayerInformation.Position; if (Input.GetKeyDown(KeyCode.R)) { if (PlayerInformation.Items.Count > 0) { PlayerInformation.Items.RemoveAt(PlayerInformation.Items.Count - 1); Vector3 position = new Vector3(this.transf.position.x + ((-1) * (PlayerInformation.Direction.x * 1.5f)), this.transf.position.y + ((-1) * (PlayerInformation.Direction.y * 1.5f)), this.transf.position.y); GameObject shiet = Instantiate(shit, position, Quaternion.identity); } } playerInput.Update(); if (currentHealth <= 0) { Death(); } }
public void Update(GameTime gameTime) { DisplayTextOverTime(gameTime); playerInput.Update(); Show(); if (playerInput.input == PlayerInput.Input.Accept && isFinish) { if (index < listDialog.Count - 1) { index += 1; currentTextIndex = 0; currentText = ""; isFinish = false; } else { index = 0; isVisible = false; } } }
// Update is called once per frame void Update() { PlayerInput.Update(); }
public void GetInput() { playerInput.Update(); }
protected void Update() { UpdateGrounded(); playerInput.Update(); // Setting max speed. if (isGrounded) { currentMaxSpeed = maxMovementSpeedGrounded; currentMaxAcceleration = maxAccelerationGrounded; } else { currentMaxSpeed = maxMovementSpeedAir; currentMaxAcceleration = maxAccelerationAir; } //Setting rotation if (!gravityReversed) { if (playerInput.horizontalLeft > 0) { transform.rotation = Quaternion.Euler(transform.eulerAngles.x, 0, 0); } else if (playerInput.horizontalLeft < 0) { transform.rotation = Quaternion.Euler(transform.eulerAngles.x, 180, 0); } } else { if (playerInput.horizontalLeft > 0) { transform.rotation = Quaternion.Euler(transform.eulerAngles.x, 180, 180); } else if (playerInput.horizontalLeft < 0) { transform.rotation = Quaternion.Euler(transform.eulerAngles.x, 0, 180); } } // Managing dash cooldown if (dashTime > 0) { dashTime -= Time.deltaTime; } else if (dashTime < 0) { dashTime = 0; } if (shootTimer > 0) { shootTimer -= Time.deltaTime; } else if (shootTimer < 0) { shootTimer = 0; } if (!doForcefield) { if (energy < 1) { energy += energyRefillPerSecond * Time.deltaTime; } if (energy + energyRefillPerSecond * Time.deltaTime > 1) { energy = 1; } } if (playerInput.horizontalLeft != 0) { ArturHelper.SetValueOfAnimator(animator, "isMoving"); } if (doShoot) { ArturHelper.SetValueOfAnimator(animator, "isShooting"); } if (playerInput.horizontalLeft == 0 && !doDash && !doForcefield && !doJump && !doShoot) { ArturHelper.SetValueOfAnimator(animator, "isIdle"); } if (doJump) { animator.SetBool("isJumping", true); } if (doDash) { animator.SetBool("isDashing", true); } }
/// <summary> /// Unity Function called a number of times every frame. Usually used if there are physics related calls. /// Handles the calls for player movement. /// </summary> void FixedUpdate() // Changed from Update to FixedUpdate { #if UNITY_ANDROID this.hAxis = GameController_v7.Instance.GetMobileUIManager().GetInputValue(); #elif UNITY_STANDALONE this.hAxis = CrossPlatformInputManager.GetAxis("Horizontal"); // Both this and the one inside playerInput.Update() is needed #endif playerInput.Update(); this.SetGrounded(false); // The player is grounded if a circlecast to the groundcheck position hits anything designated as ground // This can be done using layers instead but Sample Assets will not overwrite your project settings. Collider2D[] colliders = Physics2D.OverlapCircleAll(GetGroundCheck().position, 0.01f); // this.UnlockPlatform (); for (int i = 0; i < colliders.Length; i++) { if (colliders [i].gameObject.layer == Constants.GetGroundLayer()) { this.SetGrounded(true); } else if (colliders [i].gameObject.layer == LayerMask.NameToLayer("Breakable")) { // Raycast downwards to check if the player is ontop RaycastHit2D[] hits = Physics2D.RaycastAll( new Vector2(this.groundCheck.position.x, this.groundCheck.position.y), Vector2.down, 0.2f); foreach (RaycastHit2D hit in hits) { if (hit.collider == colliders [i]) { this.SetGrounded(true); } } } // For moving/manual platforms (to set player as parent) // if (colliders [i].gameObject.GetComponent<PlatformLock> () != null) { // this.LockPlatform (colliders [i].gameObject.GetComponent<PlatformLock> ()); // } } // A larger circle cast for platforms, used to fix moving platforms colliders = Physics2D.OverlapCircleAll(GetGroundCheck().position, 1.0f); this.UnlockPlatform(); for (int i = 0; i < colliders.Length; i++) { if (colliders [i].gameObject.GetComponent <PlatformLock> () != null) { this.LockPlatform(colliders [i].gameObject.GetComponent <PlatformLock> ()); } } #if UNITY_ANDROID playerMovement.FixedUpdate(rigidBody2d, this.hAxis, this.IsGrounded()); // NEEDED #elif UNITY_STANDALONE // Move according to horizontal axis input playerMovement.FixedUpdate(rigidBody2d, this.hAxis, this.IsGrounded()); // NEEDED #endif }
private void Update() { playerInput.Update(); mainBlockManager.Update(); }
public override void Update(float seconds) { player.Update(seconds, checker); checker.Update(seconds); }
/// <summary> /// Update all inputs. /// </summary> void UpdateInputs() { _p1Input.Update(); _p2Input.Update(); _gameInput.Update(); }