public void FixedTick(float d) { ATKMode = BaseData.Instance.atkModeData.modeName; delta = d; HandleGravity(d); HandleRun(); if (pausing) { ResetStates(); ResetAnimation(); return; } if (inAction) { anim.applyRootMotion = true; //anim.SetFloat("angle",0); anim.SetFloat("direction", 0); _actionDelay += delta; HandleLockRotationAnimations(moveDir); if (_actionDelay > _actionDelayMaxTime) { inAction = false; _actionDelay = 0; } else { return; } } canMove = anim.GetBool("canMove"); if (!canMove) { return; } a_hook.CloseRoll(); a_hook.CloseRunBreak(); anim.applyRootMotion = false; rb.drag = (moveAmount > 0 || onGround == false) ? 0:4; HandleMovement(); bodyAngle = ReturnCurrentBodyAndMoveAngle(); HandleLookAndBodyAngle(); HandleRoll(); HandleJump(); HandleGliding(); HandleRunBreak(); }
public void FixedTick(float d) { delta = d; if (dead) { return; } DetectAction(); if (attacking) { _anim.applyRootMotion = true; _actionDelay += delta; if (_actionDelay > 0.3f) { attacking = false; _actionDelay = 0; } else { return; } } canMove = _anim.GetBool("CanMove"); if (!canMove) { return; } //a_hook.rootMotionMultiplier = 1; a_hook.CloseRoll(); HandleDodges(); _anim.applyRootMotion = false; if (moveAmount > 0 || !onGround) { _rb.drag = 0; } else { _rb.drag = 4; } float targetSpeed = moveSpeed; if (run) { targetSpeed = runSpeed; } if (onGround) { _rb.velocity = moveDir * (targetSpeed * moveAmount); } if (run) { lockOn = false; } Vector3 targetDir = (lockOn == false) ? moveDir : (lockOnTransform != null) ? lockOnTransform.position - transform.position : moveDir; targetDir.y = 0; if (targetDir == Vector3.zero) { targetDir = transform.forward; } Quaternion tr = Quaternion.LookRotation(targetDir); Quaternion targetRotation = Quaternion.Slerp(transform.rotation, tr, delta * moveAmount * rotateSpeed); transform.rotation = targetRotation; _anim.SetBool("LockOn", lockOn); if (!lockOn) { HandleMovementAnimations(); } else { HandleLockOnAnimations(moveDir); } }
public void FixedTick(float d) { delta = d; isBlocking = false; usingItem = anim.GetBool(StaticStrings.interacting); anim.SetBool(StaticStrings.spellCasting, isSpellCasting); if (!closeWeapons) { if (inventoryManager.rightHandWeapon != null) { inventoryManager.rightHandWeapon.weaponModel.SetActive(!usingItem); } if (inventoryManager.leftHandWeapon != null) { inventoryManager.leftHandWeapon.weaponModel.SetActive(true); } if (inventoryManager.currentConsumable != null) { if (inventoryManager.currentConsumable.itemModel != null) { inventoryManager.currentConsumable.itemModel.SetActive(usingItem); } } } else { if (inventoryManager.leftHandWeapon != null) { inventoryManager.leftHandWeapon.weaponModel.SetActive(false); } if (inventoryManager.rightHandWeapon != null) { inventoryManager.rightHandWeapon.weaponModel.SetActive(false); } } if (!isBlocking && !isSpellCasting) { enableIK = false; //commentare per lasciare l'animazione bloccata nell'ik e regolare gli helper ed aggiustare l'animazione } //a_hook.useIK = true; //scommentare per lasciare l'animazione bloccata nell'ik e regolare gli helper ed aggiustare l'animazione if (inAction) { anim.applyRootMotion = true; _actionDelay += delta; if (_actionDelay > 0.3f) { //crossfade value inAction = false; _actionDelay = 0; } else { return; } } onEmpty = anim.GetBool(StaticStrings.onEmpty); if (onEmpty) { canAttack = true; canMove = true; } if (canRotate) { HandleRotation(); } if (!onEmpty && !canMove && !canAttack) //animation is playing { return; } closeWeapons = false; if (canMove && !onEmpty) { if (moveAmount > 0.3f) { anim.CrossFade("Empty Override", 0.1f); onEmpty = true; } } MonitorKick(); if (canAttack) { DetectAction(); } if (canMove) { DetectItemAction(); } //a_hook.rootMotionMultiplier = 1; anim.applyRootMotion = false; rigid.drag = (moveAmount > 0 || !onGround) ? 0 : 4; float targetSpeed = moveSpeed; if (usingItem || isSpellCasting) { run = false; moveAmount = Mathf.Clamp(moveAmount, 0, 0.5f); } if (run) { targetSpeed = runSpeed; } if (onGround && canMove) { rigid.velocity = moveDir * (targetSpeed * moveAmount); } if (run) { lockOn = false; } anim.SetBool(StaticStrings.lockon, lockOn); if (lockOn) { HandleLockonAnimations(moveDir); } else { HandleMovementAnimations(); } a_hook.useIK = enableIK; //commentare per lasciare l'animazione bloccata nell'ik e regolare gli helper ed aggiustare l'animazione //anim.SetBool(StaticStrings.blocking, isBlocking); anim.SetBool(StaticStrings.isLeft, isLeftHand); HandleBlocking(); if (isSpellCasting) { HandleSpellCasting(); return; } a_hook.CloseRoll(); HandleRolls(); }
public void Tick(float d) { delta = d; onGround = OnGround(); animator.SetBool(StaticStrings.animParam_OnGround, onGround); HandleAirTime(); HandleInvincibility(); HandleWeaponModelVisibility(); HandleIK(); HandleInActionTimer(); pickableItemManager.Tick(); if (onEmpty) { canAttack = true; canMove = true; } //Animation is playing, skip following actions if (!onEmpty && !canMove && !canAttack) { return; } if (canMove && !onEmpty) { if (moveAmount > 0.3f) { animator.CrossFade("Empty Override", 0.1f); onEmpty = true; } } MonitorKick(); if (canAttack) { DetectAction(); } if (canMove) { DetectItemAction(); } animator.SetBool(StaticStrings.animParam_LockOn, lockOn); if (!lockOn) { HandleMovementAnimations(); } else { HandleLockOnAnimations(moveDirection); } animHook.useIK = enableIK; //animator.SetBool(StaticStrings.animParam_Block, isBlocking); animator.SetBool(StaticStrings.animParam_IsLeft, isLeftHand); HandleBlocking(); if (isSpellCasting) { HandleSpellCasting(); return; } animHook.CloseRoll(); HandleRolls(); }