public override void FixedUpdate(float fixedDeltaTime) { if (CurrentState == State.IsMoving) { CharacterTransform.Translate(moveDirection * MoveSpeed); CharacterTransform.position = new Vector3(Mathf.Clamp(CharacterTransform.position.x, minX, maxX), CharacterTransform.position.y, Mathf.Clamp(CharacterTransform.position.z, minZ, maxZ)); } }
protected new void Update() { base.Update(); CharacterTransform.Translate(direction * moveSpeed * Time.deltaTime, Space.World); jumpCtrl(); handCtrl(); shoulderCtrl(); }
protected void jumpCtrl() { if (isJumping) { //Debug.Log(speedUp); speedUp -= grav * Time.deltaTime; //Debug.Log("im jumping"); if (CharacterTransform.transform.position.y < initPosY) { isJumping = false; speedUp = Vector3.zero; CharacterTransform.Translate(new Vector3(CharacterTransform.position.x, initPosY, CharacterTransform.position.z) - CharacterTransform.position, Space.World); } } }