// Update is called once per frame void Update() { //Moves character upwards if magnet state is true if ((bool)stateManager.GetCharacterStateValue(ConstantStrings.MAGNET_STATE)) { characterMovementHandler.AddToYPosition(magnetAttractSpeed * Time.deltaTime); } }
// Update is called once per frame void FixedUpdate() { if (knockBack) { characterMovementHandler.AddToXPosition(knockBackDirection.x * knockBackSpeed * Time.deltaTime); characterMovementHandler.AddToYPosition(knockBackDirection.y * knockBackSpeed * Time.deltaTime); currentDistanceTraveled += knockBackSpeed * Time.deltaTime; if (currentDistanceTraveled >= totalTravelDistance) { knockBack = false; currentDistanceTraveled = 0; recoilState.SetState(new bool[] { false, false }); } } }