当前位置: 首页>>代码示例>>C#>>正文


C# MyGunStatusEnum类代码示例

本文整理汇总了C#中MyGunStatusEnum的典型用法代码示例。如果您正苦于以下问题:C# MyGunStatusEnum类的具体用法?C# MyGunStatusEnum怎么用?C# MyGunStatusEnum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MyGunStatusEnum类属于命名空间,在下文中一共展示了MyGunStatusEnum类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanShoot

        public override bool CanShoot(MyShootActionEnum action, long shooter, out MyGunStatusEnum status)
        {
            bool retval = base.CanShoot(action, shooter, out status);

            // No need for cooldown for the first shot
            if (status == MyGunStatusEnum.Cooldown && action == MyShootActionEnum.PrimaryAction && m_firstShot == true)
            {
                status = MyGunStatusEnum.OK;
                retval = true;
            }

            return retval;
        }
开发者ID:austusross,项目名称:SpaceEngineers,代码行数:13,代码来源:MyBlockPlacerBase.cs

示例2: ShootBeginFailed

 private void ShootBeginFailed(MyShootActionEnum action, MyGunStatusEnum status, IMyGunObject<MyDeviceBase> failedGun)
 {
     failedGun.BeginFailReaction(action, status);
 }
开发者ID:notten,项目名称:SpaceEngineers,代码行数:4,代码来源:MyShipController.cs

示例3: ShowShootNotification

        private void ShowShootNotification(MyGunStatusEnum status, IMyGunObject<MyDeviceBase> weapon)
        {
            if (!ControllerInfo.IsLocallyHumanControlled())
                return;

            switch (status)
            {
                case MyGunStatusEnum.NotSelected:
                    if (m_noWeaponNotification == null)
                    {
                        m_noWeaponNotification = new MyHudNotification(MySpaceTexts.NotificationNoWeaponSelected, 2000, font: MyFontEnum.Red);
                        MyHud.Notifications.Add(m_noWeaponNotification);
                    }

                    MyHud.Notifications.Add(m_noWeaponNotification);
                    break;
                case MyGunStatusEnum.OutOfAmmo:
                    if (m_outOfAmmoNotification == null)
                    {
                        m_outOfAmmoNotification = new MyHudNotification(MySpaceTexts.OutOfAmmo, 2000, font: MyFontEnum.Red);
                    }

                    if (weapon is MyCubeBlock)
                        m_outOfAmmoNotification.SetTextFormatArguments((weapon as MyCubeBlock).DisplayNameText);

                    MyHud.Notifications.Add(m_outOfAmmoNotification);
                    break;
                case MyGunStatusEnum.NotFunctional:
                case MyGunStatusEnum.OutOfPower:
                    if (m_weaponNotWorkingNotification == null)
                    {
                        m_weaponNotWorkingNotification = new MyHudNotification(MySpaceTexts.NotificationWeaponNotWorking, 2000, font: MyFontEnum.Red);
                    }

                    if (weapon is MyCubeBlock)
                        m_weaponNotWorkingNotification.SetTextFormatArguments((weapon as MyCubeBlock).DisplayNameText);

                    MyHud.Notifications.Add(m_weaponNotWorkingNotification);
                    break;
                default:
                    break;
            }
        }
开发者ID:notten,项目名称:SpaceEngineers,代码行数:43,代码来源:MyShipController.cs

示例4: ShootFailReactionLocal

 public void ShootFailReactionLocal(MyShootActionEnum action, MyGunStatusEnum status)
 { }
开发者ID:notten,项目名称:SpaceEngineers,代码行数:2,代码来源:MySmallMissileLauncher.cs

示例5: CanShoot

        public override bool CanShoot(MyShootActionEnum action, long shooter, out MyGunStatusEnum status)
        {
            status = MyGunStatusEnum.OK;
            if (action != MyShootActionEnum.PrimaryAction)
            {
                status = MyGunStatusEnum.Failed;
                return false;
            }

            if (!m_gunBase.HasAmmoMagazines)
            {
                status = MyGunStatusEnum.Failed;
                return false;
            }

            if ((MySandboxGame.TotalGamePlayTimeInMilliseconds - m_lastTimeShoot) < m_gunBase.ShootIntervalInMiliseconds / (CubeGrid.GridSizeEnum == MyCubeSize.Small ? 1 : 4))
            {
                status = MyGunStatusEnum.Cooldown;
                return false;
            }

            if (!HasPlayerAccess(shooter))
            {
                status = MyGunStatusEnum.AccessDenied;
                return false;
            }
            if (!PowerReceiver.IsPowered)
            {
                status = MyGunStatusEnum.OutOfPower;
                return false;
            }
            if (!IsFunctional)
            {
                status = MyGunStatusEnum.NotFunctional;
                return false;
            }
            if (!Enabled)
            {
                status = MyGunStatusEnum.Disabled;
                return false;
            }
            if (!MySession.Static.CreativeMode && !m_gunBase.HasEnoughAmmunition())
            {
                status = MyGunStatusEnum.OutOfAmmo;
                return false;
            }
            return true;
        }
开发者ID:notten,项目名称:SpaceEngineers,代码行数:48,代码来源:MySmallMissileLauncher.cs

示例6: BeginFailReaction

 public void BeginFailReaction(MyShootActionEnum action, MyGunStatusEnum status)
 {
     if (status == MyGunStatusEnum.OutOfAmmo && !MySession.Static.CreativeMode)
         m_gunBase.StartNoAmmoSound(m_soundEmitter);
 }
开发者ID:notten,项目名称:SpaceEngineers,代码行数:5,代码来源:MySmallMissileLauncher.cs

示例7: BeginFailReaction

        public override void BeginFailReaction(MyShootActionEnum action, MyGunStatusEnum status)
        {
            base.BeginFailReaction(action, status);

            m_soundEmitter.PlaySingleSound(weldSoundIdle, true, true);

            FillStockpile();
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:8,代码来源:MyWelder.cs

示例8: ShootFailedLocal

        private void ShootFailedLocal(MyShootActionEnum action, MyGunStatusEnum status)
        {

        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:4,代码来源:MyControllableSphere.cs

示例9: CanShoot

        internal bool CanShoot(MyShootActionEnum action, out MyGunStatusEnum status, out IMyGunObject<MyDeviceBase> FailedGun)
        {
            FailedGun = null;
            if (m_currentGuns == null)
            {
                status = MyGunStatusEnum.NotSelected;
                return false;
            }

            bool result = false;
            status = MyGunStatusEnum.OK;

            // Report only one weapon status; Return true if any of the weapons can shoot
            foreach (var weapon in m_currentGuns)
            {
                MyGunStatusEnum weaponStatus;
                result |= weapon.CanShoot(action, m_shipController.ControllerInfo.Controller != null ? m_shipController.ControllerInfo.Controller.Player.Identity.IdentityId : m_shipController.OwnerId, out weaponStatus);
                // mw:TODO maybe autoswitch when gun has no ammo?
                //if (weaponStatus == MyGunStatusEnum.OutOfAmmo)
                //{
                //    if (weapon.GunBase.SwitchAmmoMagazineToFirstAvailable())
                //    {
                //        weaponStatus = MyGunStatusEnum.OK;
                //        result = true;
                //    }
                //}
                if (weaponStatus != MyGunStatusEnum.OK)
                {
                    FailedGun = weapon;
                    status = weaponStatus;
                }
            }

            return result;
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:35,代码来源:MyGridSelectionSystem.cs

示例10: CanShoot

        public override bool CanShoot(MyShootActionEnum action, long shooter, out MyGunStatusEnum status)
        {
            if (action == MyShootActionEnum.SecondaryAction)
            {
				status = MyGunStatusEnum.OK;
                return true;
            }

            if (!base.CanShoot(action, shooter, out status))
            {
                return false;
            }


            status = MyGunStatusEnum.OK;
            var block = GetTargetBlock();
            if (block == null)
            {
                var info = FindProjectedBlock();
                if (info.raycastResult == BuildCheckResult.OK)
                {
                    return true;
                }

                status = MyGunStatusEnum.Failed;
                return false;
            }

            Debug.Assert(Owner is MyCharacter, "Only character can use welder!");
            if (Owner == null)
            {
                status = MyGunStatusEnum.Failed;
                return false;
            }

            if (MySession.Static.CreativeMode && (!block.IsFullIntegrity || block.HasDeformation))
            {
                return true;
            }

            if (block.IsFullIntegrity && block.HasDeformation)
            {
                return true;
            }

            {
                var info = FindProjectedBlock();
                if (info.raycastResult == BuildCheckResult.OK)
                {
                    return true;
                }
            }

            MyCharacter character = Owner as MyCharacter;
            System.Diagnostics.Debug.Assert(character.GetInventory() as MyInventory != null, "Null or unexpected inventory type returned!");
            if (!block.CanContinueBuild(character.GetInventory() as MyInventory))
            {
                status = MyGunStatusEnum.Failed;
                if (!block.IsFullIntegrity)
                    if (Owner != null && Owner == MySession.Static.LocalCharacter)
                        BeginFailReactionLocal(0, 0);
                return false;
            }

            return true;
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:66,代码来源:MyWelder.cs

示例11: CanShoot

 public virtual bool CanShoot(out MyGunStatusEnum status)
 {
     status = MyGunStatusEnum.OK;
     return true;
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:5,代码来源:MyUserControllableGun.cs

示例12: ShootBeginFailed

        private void ShootBeginFailed(MyShootActionEnum action, MyGunStatusEnum status)
        {

        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:4,代码来源:MyControllableSphere.cs

示例13: ShootFailedLocal

        private void ShootFailedLocal(MyShootActionEnum action, MyGunStatusEnum status)
        {
            if (status == MyGunStatusEnum.OutOfAmmo)
            {
                ShowOutOfAmmoNotification();
            }

            m_currentWeapon.ShootFailReactionLocal(action, status);
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:9,代码来源:MyCharacter.cs

示例14: BeginFailReactionLocal

        public override void BeginFailReactionLocal(MyShootActionEnum action, MyGunStatusEnum status)
        {
            var block = GetTargetBlock();

            if (block != m_failedBlock)
            {
                UnmarkMissingComponent();
                MyHud.Notifications.Remove(m_missingComponentNotification);
            }

            m_failedBlock = block;

            if (block == null)
                return;

            if (block.IsFullIntegrity)
                return;

            int missingGroupIndex, missingGroupAmount;
            block.ComponentStack.GetMissingInfo(out missingGroupIndex, out missingGroupAmount);

            var missingGroup = block.ComponentStack.GetGroupInfo(missingGroupIndex);
            MarkMissingComponent(missingGroupIndex);
            m_missingComponentNotification.SetTextFormatArguments(
                string.Format("{0} ({1}x)", missingGroup.Component.DisplayNameText, missingGroupAmount),
                block.BlockDefinition.DisplayNameText.ToString());
            MyHud.Notifications.Add(m_missingComponentNotification);
            if ((m_playedFailSound && m_failedBlockSound != block) || m_playedFailSound == false)
            {
                MyGuiAudio.PlaySound(MyGuiSounds.HudUnable);
                m_playedFailSound = true;
                m_failedBlockSound = block;
            }
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:34,代码来源:MyWelder.cs

示例15: ShootBeginFailed

        private void ShootBeginFailed(MyShootActionEnum action, MyGunStatusEnum status)
        {
            m_currentWeapon.BeginFailReaction(action, status);

            if (MySession.Static.ControlledEntity == this)
            {
                m_currentWeapon.BeginFailReactionLocal(action, status);
            }
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:9,代码来源:MyCharacter.cs


注:本文中的MyGunStatusEnum类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。