示例#1
0
文件: Player.cs 项目: Onin1/shootmup
        public AttackStateEnum Reload()
        {
            // check if we have a primary weapon
            if (Primary == null)
            {
                return(AttackStateEnum.None);
            }
            if (!Primary.HasAmmo())
            {
                return(AttackStateEnum.NoRounds);
            }
            // check if there are rounds
            if (Primary.RoundsInClip(out int rounds))
            {
                return(AttackStateEnum.FullyLoaded);
            }

            bool reload = Primary.Reload();

            if (reload)
            {
                return(AttackStateEnum.Reloaded);
            }
            else
            {
                throw new Exception("Failed to reload");
            }
        }