コード例 #1
0
ファイル: Weapon.cs プロジェクト: sultim-t/ShootAndDrive
        /// <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);
            }
        }
コード例 #2
0
ファイル: Weapon.cs プロジェクト: sultim-t/ShootAndDrive
 /// <summary>
 /// Shortcut for 'AllWeaponsStats.Instance.CanBreak'
 /// </summary>
 bool CanBreak()
 {
     return(AllWeaponsStats.CanBreak(AmmoType));
 }