protected void Update() { if (aimer.Target != null) { walkingState = MovingState.STAYING; aimer.FollowTarget(); if (Time.time - lastShootTime >= (1 / attackSpeed)) { lastShootTime = Time.time; shooter.Shoot(new DamageReport(damage, this)); animActions.Attack(); } } }
/// <summary> /// Called when Input Vector2 is changed /// </summary> /// <param name="direction"></param> private void CheckMovementState(Vector2 direction) { if (walkingState == MovingState.STAYING && direction != Vector2.zero) { walkingState = MovingState.MOVING; animActions.Run(); } else { if (walkingState == MovingState.MOVING && direction == Vector2.zero) { walkingState = MovingState.STAYING; animActions.Stay(); animActions.Attack(); } } }