/// <summary> /// Updates the current information from the controller's state and sends it to the animator. /// </summary> public void UpdateAnimation(float timeStep) { if (hurting > 0) { hurting -= timeStep; animInfo.hurt = true; } else { animInfo.hurt = false; } animInfo.dashing = moveToPosition.dashing; if (weapon.IsAttacking()) { animInfo.attacking = true; animInfo.blocking = false; if (mouseInfo.position1.x < transform.position.x) { animInfo.mouseDirection = -1; } else { animInfo.mouseDirection = 1; } } else if (mouseInfo.holding && mouseInfo.holdDuration > delayUntilCharging) { animInfo.attacking = false; animInfo.blocking = true; if (mouseInfo.position1.x < transform.position.x) { animInfo.mouseDirection = -1; } else { animInfo.mouseDirection = 1; } } else { animInfo.attacking = false; animInfo.blocking = false; animInfo.mouseDirection = moveToPosition.moveDirection; } float speed = (canBeSlowed.value && !slowLeftSide.value) ? slowAmount.value : 1f; animScript.UpdateState(animInfo, speed); }
/// <summary> /// Updates the animation information for the soldier. /// </summary> /// <param name="timeStep"></param> public void UpdateAnimation(float timeStep) { animInfo.blocking = (blockTime != 0); animInfo.jumping = !moveJumping.grounded; if (hurting > 0) { hurting -= timeStep; animInfo.hurt = true; } else { animInfo.hurt = false; } animInfo.overheat = !gridUseable.value; if (attacking > 0) { animInfo.attacking = true; attacking -= timeStep; if (grid.attackDirection == Constants.Direction.LEFT) { animInfo.mouseDirection = -1; } else if (grid.attackDirection == Constants.Direction.RIGHT) { animInfo.mouseDirection = 1; } else { animInfo.mouseDirection = 0; } } else { animInfo.attacking = false; animInfo.mouseDirection = 0; } float speed = (useSlowTime.value && slowSoldierSide.value) ? slowAmount.value : 1f; animScript.UpdateState(animInfo, speed); }
public void UpdateAnimation(float timeStep) { animInfo.blocking = (blockTime != 0); animInfo.jumping = !moveJumping.grounded; if (hurting > 0 || grid.locked) { hurting--; animInfo.hurt = true; } else { animInfo.hurt = false; } if (attacking > 0) { animInfo.attacking = true; attacking--; if (grid.attackDirection == Constants.Direction.LEFT) { animInfo.mouseDirection = -1; } else if (grid.attackDirection == Constants.Direction.RIGHT) { animInfo.mouseDirection = 1; } else { animInfo.mouseDirection = 0; // Debug.Log("Neutral direction"); } } else { animInfo.attacking = false; animInfo.mouseDirection = 0; } float speed = (canBeSlowed.value && slowLeftSide.value) ? slowAmount.value : 1f; animScript.UpdateState(animInfo, speed); }
/// <summary> /// Updates the current information from the controller's state and sends it to the animator. /// </summary> public void UpdateAnimation() { animInfo.walkDirection = Constants.Direction.NEUTRAL; if (moveToPosition.moveDirectionX == -2) { animInfo.walkDirection = Constants.Direction.LEFT; } else if (moveToPosition.moveDirectionX == 2) { animInfo.walkDirection = Constants.Direction.RIGHT; } else if (moveToPosition.moveDirectionY == 2) { animInfo.walkDirection = Constants.Direction.UP; } else if (moveToPosition.moveDirectionY == -2) { animInfo.walkDirection = Constants.Direction.DOWN; } animScript.UpdateState(animInfo, (paused.value) ? 0f : 1f); }