Example #1
0
    public float PenetrationCheck(UrbSubstanceTag Penetrator, float Amount, float Force)
    {
        if (Layers == null || Layers.Length == 0)
        {
            return(Amount);
        }

        float Result      = 0;
        float Depth       = Force;
        float PenHardness = UrbSubstanceProperties.Get(Penetrator).Hardness;

        for (int i = 0; i < Layers.Length; i++)
        {
            float LayerThickness   = Thickness(Layers[i]);
            float LayerHardness    = UrbSubstanceProperties.Get(Layers[i]).Hardness;
            float LayerFlexibility = UrbSubstanceProperties.Get(Layers[i]).Flexibility;

            Depth *= PenHardness / LayerHardness;


            if (Depth > LayerThickness)
            {
                float Damage = LayerFlexibility > 0 ? (Amount * LayerThickness) / LayerFlexibility : Amount * LayerThickness;
                LayerDamage[i] += Damage;
                Result         += Damage;
                Depth          -= LayerThickness;
            }
            else
            {
                float Damage = LayerFlexibility > 0 ? (Amount * Depth) / LayerFlexibility : Amount * Depth;
                LayerDamage[i] += Damage;
                Result         += Damage;
                break;
            }
        }

        return(Result);
    }
Example #2
0
 public static UrbScentTag[] Scent(UrbSubstanceTag input)
 {
     return(UrbSubstanceProperties.Get(input).Scent);
 }