Beispiel #1
0
    private IEnumerator ParryRoutine()
    {
        AttackIndictator attackIndicator = characterComponents.attackIndicator;

        yield return(timestamps.GetNextWait(0));

        //parry start
        characterComponents.characterSheet.AddEffect(useEffect);
        characterComponents.characterSheet.AddAttackListener(this);
        attackIndicator.EnableBlockIndicator(blockConfig.blockAngle);

        yield return(timestamps.GetNextWait(1));

        //parry end
        EndParry(false);

        yield return(timestamps.GetNextWait(2));

        //ability end
        EndAbility();
    }
Beispiel #2
0
    private IEnumerator ChargeRoutine()
    {
        yield return(timestamps.GetNextWait(0));

        //start charging/moving
        characterComponents.characterSheet.AddEffect(useEffect, -1);
        characterComponents.characterSheet.AddAttackListener(this);
        characterComponents.attackIndicator.EnableBlockIndicator(blockConfig.blockAngle);
        //force move forward
        characterComponents.movement.SetLockedMove(0, 1);
        var touching = characterComponents.movement.GetTouchingColliders;

        for (int i = 0; i < touching.Count; i++)
        {
            if (touching[i] == null)
            {
                continue;
            }

            var touchingRigidbody = touching[i].attachedRigidbody;
            if (touchingRigidbody == null)
            {
                continue;
            }

            HitRigidbody(touchingRigidbody);
            if (IsUsing == false)
            {
                //we've hit something
                yield return(null);
            }
        }

        characterComponents.movement.OnCollisionEvent += OnChargeCollision;

        yield return(timestamps.GetNextWait(1));

        EndUse(false);
    }
    private IEnumerator AttackRoutine()
    {
        yield return(timestamps.GetNextWait(0));

        //damage start
        characterComponents.characterSheet.AddEffect(useEffect);
        int calculateDamage = characterComponents.characterSheet.CalculateAttackDamage(damage);

        foreach (var box in damageBoxes)
        {
            box.StartAttack(characterComponents.fighter, calculateDamage, heft);
        }

        yield return(timestamps.GetNextWait(1));

        //damage end
        EndDamage();

        yield return(timestamps.GetNextWait(2));

        //ability end
        EndAbility();
    }
    private IEnumerator RangedRoutine()
    {
        yield return(timestamps.GetNextWait(0));

        //shoot projectile
        characterComponents.characterSheet.AddEffect(useEffect);
        Projectile newProjectile = Instantiate(
            projectile,
            spawnPoint.position,
            characterComponents.movement.head.rotation);

        newProjectile.Setup(characterComponents.characterSheet.CalculateAttackDamage(damage),
                            heft,
                            characterComponents.characterSheet);

        yield return(timestamps.GetNextWait(1));

        EndAbility();

        yield return(timestamps.GetNextWait(2));

        EndCooldown();
    }