コード例 #1
0
ファイル: Girl.cs プロジェクト: roman10x/rr_scripts
 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();
         }
     }
 }
コード例 #2
0
ファイル: Player.cs プロジェクト: roman10x/rr_scripts
    /// <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();
            }
        }
    }