Esempio n. 1
0
    public virtual void AnimateAttack()
    {
        Vector3 targetPos = _currentTarget.transform.position;

        targetPos.x += (_currentTarget.Sprite.bounds.size.x) * (!_playerScript.IsMe ? 1 : -1);
        LTSeq seq = LeanTween.sequence();

        seq.append(LeanTween.move(gameObject, targetPos, 0.5f));
        seq.append(0.2f);

        DoDamage(seq, targetPos, _currentTarget);
        _currentTarget.DoDamage(seq, targetPos, this, true);

        seq.append(() => _unitSprite.flipX = !_unitSprite.flipX);
        seq.append(LeanTween.moveLocal(gameObject, Vector3.zero, 0.5f));
        seq.append(() => _unitSprite.flipX = !_unitSprite.flipX);
        seq.append(() => _unit.SetGettingReady());
        seq.append(() => _unitAction = UnitAction.Idle);
    }