本文整理汇总了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;
}
示例2: ShootBeginFailed
private void ShootBeginFailed(MyShootActionEnum action, MyGunStatusEnum status, IMyGunObject<MyDeviceBase> failedGun)
{
failedGun.BeginFailReaction(action, status);
}
示例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;
}
}
示例4: ShootFailReactionLocal
public void ShootFailReactionLocal(MyShootActionEnum action, MyGunStatusEnum status)
{ }
示例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;
}
示例6: BeginFailReaction
public void BeginFailReaction(MyShootActionEnum action, MyGunStatusEnum status)
{
if (status == MyGunStatusEnum.OutOfAmmo && !MySession.Static.CreativeMode)
m_gunBase.StartNoAmmoSound(m_soundEmitter);
}
示例7: BeginFailReaction
public override void BeginFailReaction(MyShootActionEnum action, MyGunStatusEnum status)
{
base.BeginFailReaction(action, status);
m_soundEmitter.PlaySingleSound(weldSoundIdle, true, true);
FillStockpile();
}
示例8: ShootFailedLocal
private void ShootFailedLocal(MyShootActionEnum action, MyGunStatusEnum status)
{
}
示例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;
}
示例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;
}
示例11: CanShoot
public virtual bool CanShoot(out MyGunStatusEnum status)
{
status = MyGunStatusEnum.OK;
return true;
}
示例12: ShootBeginFailed
private void ShootBeginFailed(MyShootActionEnum action, MyGunStatusEnum status)
{
}
示例13: ShootFailedLocal
private void ShootFailedLocal(MyShootActionEnum action, MyGunStatusEnum status)
{
if (status == MyGunStatusEnum.OutOfAmmo)
{
ShowOutOfAmmoNotification();
}
m_currentWeapon.ShootFailReactionLocal(action, status);
}
示例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;
}
}
示例15: ShootBeginFailed
private void ShootBeginFailed(MyShootActionEnum action, MyGunStatusEnum status)
{
m_currentWeapon.BeginFailReaction(action, status);
if (MySession.Static.ControlledEntity == this)
{
m_currentWeapon.BeginFailReactionLocal(action, status);
}
}