Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace BasicItems.Items.Weapons.Guns
- {
- public class MarksmanRifle00_AmmoLoaded : ModPlayer
- {
- private int _AmmoLoaded;
- public virtual int AmmoLoaded
- {
- get { return _AmmoLoaded; }
- set
- {
- _AmmoLoaded = (value < 0 ? 0 : value) > AmmoCapacity ? AmmoCapacity : value;
- }
- }
- public static readonly int loadTimePerRoundTicks = (int)(.7f * 60f); //To be replaced with Flags config data
- public int TimeToNextLoad;
- public static readonly int AmmoCapacity = 15; //To be replaced with Flags config data
- public virtual bool IsFullyLoaded {
- get { return (AmmoLoaded >= AmmoCapacity); }
- }
- public virtual bool LoadNextRound {
- get { return (TimeToNextLoad <= 0); }
- }
- public virtual bool HasAmmo {
- get { return AmmoLoaded > 0; }
- }
- public override void Initialize()
- {
- AmmoLoaded = AmmoCapacity;
- TimeToNextLoad = loadTimePerRoundTicks;
- }
- public override void PreUpdate()
- {
- if (!IsFullyLoaded)
- {
- if (LoadNextRound)
- {
- TimeToNextLoad = loadTimePerRoundTicks;
- AmmoLoaded++;
- }
- else
- {
- TimeToNextLoad--;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement