예제 #1
0
 public override void StartUse()
 {
     base.StartUse();
     if ((target.position.x > transform.position.x && !flip.isFacingRight) ||
         (target.position.x < transform.position.x && flip.isFacingRight))
     {
         flip.FlipObject();
     }
     anim.SetTrigger("meteorAttack");
 }
    public void LookOnTarget()
    {
        var direction = CalculateDirection();

        if ((direction < 0f && flip.isFacingRight) || (direction > 0f && !flip.isFacingRight))
        {
            flip.FlipObject();
        }
        Task.current.Succeed();
    }
예제 #3
0
 public override void StartUse()
 {
     base.StartUse();
     if ((target.transform.position.x > transform.position.x && !flip.isFacingRight) ||
         (target.transform.position.x < transform.position.x && flip.isFacingRight))
     {
         flip.FlipObject();
     }
     fireDirection = (flip.isFacingRight) ? 1f : -1f;
     anim.SetTrigger("rangeAttack");
 }
    private void TryToAttackEnemie()
    {
        Collider2D enemieInAttackArea = Physics2D.OverlapBox(
            transform.position,
            applicationArea,
            0f,
            layerMask);

        if (enemieInAttackArea == null)
        {
            return;
        }
        var positionDifference = Mathf.Sign(enemieInAttackArea.transform.position.x - transform.position.x);

        if (!flip.isFacingRight && positionDifference == 1f ||
            flip.isFacingRight && positionDifference == -1f)
        {
            flip.FlipObject();
        }
        fighter.StartAttack();
        illusionState = IllusionStates.Attack;
    }