예제 #1
0
    public void StartAttack(int pIndex, bool pHeavy)
    {
        // Reset attack progress
        _attackProgress = 0;
        _anim.SetFloat("Attacking Progress", pIndex == 1 ? 1 : 0);

        // Get SOAttack values
        SOAttack curAttack = _modelController.attacks[pIndex + (pHeavy ? 3 : 0)];

        _attackLength = curAttack.attackTime;
        _attackGraph  = curAttack.attackGraph;

        if (pIndex == 0)
        {
            // Snap to first attack
            _anim.SetFloat("Attacking Index", 0);
            _anim.SetFloat("Attacking Type", pHeavy ? 1 : 0);
            _doneAttackTransition = 2;
        }
        else
        {
            // Start transitions to next attack
            _attackTransitionRate = 1 / curAttack.transitionToTime;
            _doneAttackTransition = 0;

            StopCoroutine("AttackingTypeTransition");
            StartCoroutine("AttackingTypeTransition", pHeavy ? 1 : 0);

            StopCoroutine("AttackingIndexTransition");
            StartCoroutine("AttackingIndexTransition", pIndex);
        }
    }
 private void SetAttackValues(SOAttack pAttackVars, float pPreAttackTime = 0)
 {
     _exitStateTime  = Time.time + pAttackVars.attackTime + pPreAttackTime + pAttackVars.holdEndPosTime;
     _addForceTime   = Time.time + pAttackVars.forceForwardTime + pPreAttackTime;
     _stopForceTime  = Time.time + pAttackVars.stopForceForwardTime + pPreAttackTime;
     _addForceAmount = pAttackVars.forceForwardAmount;
 }
    private void ReleaseHeavyAttackBeforeCharging()
    {
        SOAttack curAttack     = _stateController._modelController.attacks[_numberOfClicks + 3];
        float    PreAttackTime = curAttack.transitionToTime + curAttack.holdStartPosTime;

        SetAttackValues(curAttack, PreAttackTime);

        _stateController._modelController.PlayAttack(_numberOfClicks, true, false);

        // TODO set player hitbox damage & knockback

        _numberOfClicks++;
    }
    private void PressedLightAttack()
    {
        SOAttack curAttack     = _stateController._modelController.attacks[_numberOfClicks];
        float    PreAttackTime = curAttack.transitionToTime + curAttack.holdStartPosTime;

        SetAttackValues(curAttack, PreAttackTime);

        _stateController._modelController.PlayAttack(_numberOfClicks, false, false);

        // TODO set player hitbox damage & knockback

        _numberOfClicks++;
    }
    private void ReleaseHeavyAttack()
    {
        SOAttack curAttack = _stateController._modelController.attacks[_numberOfClicks + 3];

        SetAttackValues(curAttack);

        // TODO send through how long attack was charged for and use that to know how fast the attack should move.
        _stateController._modelController.DoneChargingAttack();

        // TODO set player hitbox damage & knockback (including charging)

        _onHolding = false;
        _numberOfClicks++;
    }
예제 #6
0
    public void PlayAttack(int pIndex, bool pHeavy, bool pChargable)
    {
        SOAttack curAttack = attacks[pIndex + (pHeavy ? 3 : 0)];

        StopCoroutine("DoneAttackWithDelay");
        StopCoroutine("PlayAttackWithDelay");

        // Chargeable Attack - wait for done charging before starting attack
        if (pChargable == true)
        {
            _AttackingState = 2;
        }
        // Non-Chargable Attack
        else
        {
            StartCoroutine("PlayAttackWithDelay", curAttack.holdStartPosTime);
        }

        _AttackingDirection            = pIndex == 1 ? false : true;
        _doneAttackDelay               = curAttack.holdEndPosTime;
        _modelMovement.DisableRotation = true;
        _modelWeights.SetWeights(0, 0, 1, 0);
        _modelAnimation.StartAttack(pIndex, pHeavy);
    }