private void Update() { float horizontal = 0; //Used to store the horizontal move direction. float vertical = 0; //Used to store the vertical move direction. horizontal = Input.GetAxisRaw("Horizontal2"); vertical = Input.GetAxisRaw("Vertical2"); MovingVector = new Vector2(horizontal, vertical); moving = horizontal != 0 || vertical != 0; if (moving) { movingModule.AttemptMove(horizontal, vertical); } foreach (var item in itemsCollided) { item.AskActivation(); } }
private void Update() { float horizontal = 0; //Used to store the horizontal move direction. float vertical = 0; //Used to store the vertical move direction. float energyRatio = 0; horizontal = Input.GetAxisRaw("Horizontal"); vertical = Input.GetAxisRaw("Vertical"); MovingVector = new Vector2(horizontal, vertical); moving = horizontal != 0 || vertical != 0; if (moving) { energyRatio = Vector3.Distance(movingModule.AttemptMove(horizontal, vertical), new Vector3()); } UpdateDisturbed(); UpdateEnergy(energyRatio); var dt = (Time.time - roundStart) / regularTime; gameAccelerationCoef = dt < 1.0f ? 1.0f : 1.0f + Mathf.Pow(dt - 1, 2); }