Exemplo n.º 1
0
    public AttackInfo(GameUnit caster,
                      float damage,
                      float pushPower,
                      string targetTag,
                      Vector3 attackPosition,
                      int enableHitCount,
                      AttackSuccessDelegate attackSuccess,
                      AttackFailedDelegate attackFailed)
    {
        _ = caster != null ? caster : throw new System.ArgumentNullException(nameof(caster));
        if (pushPower < 0f)
        {
            throw new System.ArgumentOutOfRangeException(nameof(pushPower), "Must be greater than or equal to 0.");
        }
        _ = targetTag ?? throw new System.ArgumentNullException(nameof(targetTag));
        if (enableHitCount < 1)
        {
            throw new System.ArgumentOutOfRangeException(nameof(enableHitCount), "Must be greater than or equal to 0.");
        }

        //allocate
        _caster         = caster;
        _damage         = damage;
        _pushPower      = pushPower;
        _targetTag      = targetTag;
        _attackPosition = attackPosition;
        _enableHitCount = enableHitCount;
        _attackSuccess  = attackSuccess;
        _attackFailed   = attackFailed;
    }
Exemplo n.º 2
0
 public AttackInfo(GameUnit caster,
                   float damage,
                   float pushPower,
                   string targetTag,
                   Vector3 attackPosition,
                   int enableHitCount,
                   AttackSuccessDelegate attackSuccess) : this(caster, damage, pushPower, targetTag, attackPosition, enableHitCount, attackSuccess, null)
 {
 }