Exemplo n.º 1
0
        /// <summary>
        /// Should this weapon jam?
        /// </summary>
        bool ToJam()
        {
            // throwables and cannon never jam
            if (!AllWeaponsStats.CanJam(AmmoType))
            {
                return(false);
            }

            if (refHealth.Value >= 3)
            {
                float healthPercentage = (float)refHealth.Value / Durability;

                return(healthPercentage > PercentageForJam ? false : Random.Range(0.0f, 1.0f) < JamProbability);
            }
            else if (refHealth.Value == 2)
            {
                return(Random.Range(0.0f, 1.0f) > 0.3f);
            }
            else
            {
                // last shot always jam
                return(true);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Shortcut for 'AllWeaponsStats.Instance.CanBreak'
 /// </summary>
 bool CanBreak()
 {
     return(AllWeaponsStats.CanBreak(AmmoType));
 }