public override void Init(StringBuilder hudLabelText, MySmallShip parentObject, Vector3 position, Vector3 forwardVector, Vector3 upVector, MyMwcObjectBuilder_SmallShip_Weapon objectBuilder) { Init(hudLabelText, m_model, MyMaterialType.METAL, parentObject, position, forwardVector, upVector, objectBuilder); m_lastTimeStarted = MyConstants.FAREST_TIME_IN_PAST; m_lastTimeEjected = MyConstants.FAREST_TIME_IN_PAST; CurrentState = MyDrillStateEnum.InsideShip; m_maxEjectDistance = MyDrillDeviceConstants.EJECT_DISTANCE_MULTIPLIER * ModelLod0.BoundingBoxSize.Z; m_ejectedDistance = 0; }
protected virtual void PullDrillBack() { StopDrillingCue(); StopMovingCue(); m_fullyEjected = false; m_ejectedDistance -= MyDrillDeviceConstants.DRILL_EJECTING_SPEED; if (m_ejectedDistance > 0.01f) { SetDrillScale(m_ejectedDistance / m_maxEjectDistance); } else { m_ejectedDistance = 0; CurrentState = MyDrillStateEnum.InsideShip; } }
public override bool Shot(MyMwcObjectBuilder_SmallShip_Ammo usedAmmo) { if (MySession.Is25DSector) { CurrentState = MyDrillStateEnum.Activated; } if (!m_fullyEjected || GetParentMinerShip().Fuel <= 0 || !GetParentMinerShip().Config.Engine.On) { return(false); } m_lastTimeStarted = MyMinerGame.TotalGamePlayTimeInMilliseconds; CurrentState = MyDrillStateEnum.Drilling; return(true); }
public override void UpdateAfterSimulation() { base.UpdateAfterSimulation(); // HACK: Multiplayer if (IsDummy && CurrentState == MyDrillStateEnum.Drilling) { Shot(null); } switch (CurrentState) { case MyDrillStateEnum.InsideShip: // If drill isnt active we stop sound that might not be stopped before StopDustEffect(); StopIdleCue(); return; case MyDrillStateEnum.Deactivated: PullDrillBack(); return; case MyDrillStateEnum.Activated: EjectDrill(); break; case MyDrillStateEnum.Drilling: Drill(); break; } if ((m_drillCue != null) && m_drillCue.Value.IsPlaying) { MyAudio.UpdateCuePosition(m_drillCue, WorldMatrix.Translation, WorldMatrix.Forward, WorldMatrix.Up, this.Parent.Physics.LinearVelocity); } if ((MyMinerGame.TotalGamePlayTimeInMilliseconds - m_lastTimeStarted) > 100) { CurrentState = MyDrillStateEnum.Activated; StopDrillingCue(); StopDustEffect(); //StopMovingCue(); } }
public virtual bool Eject() { var ejectedLongAgoEnough = (MyMinerGame.TotalGamePlayTimeInMilliseconds - m_lastTimeEjected) > MyDrillDeviceConstants.DRILL_EJECT_INTERVAL_IN_MILISECONDS; if (CurrentState == MyDrillStateEnum.InsideShip && ejectedLongAgoEnough) { CurrentState = MyDrillStateEnum.Activated; m_lastTimeEjected = MyMinerGame.TotalGamePlayTimeInMilliseconds; SetDrillScale(0.01f); this.Visible = false; return(true); } if (CurrentState == MyDrillStateEnum.Activated && m_fullyEjected && ejectedLongAgoEnough) { CurrentState = MyDrillStateEnum.Deactivated; m_lastTimeEjected = MyMinerGame.TotalGamePlayTimeInMilliseconds; } return(false); }
public virtual bool Eject() { var ejectedLongAgoEnough = (MyMinerGame.TotalGamePlayTimeInMilliseconds - m_lastTimeEjected) > MyDrillDeviceConstants.DRILL_EJECT_INTERVAL_IN_MILISECONDS; if (CurrentState == MyDrillStateEnum.InsideShip && ejectedLongAgoEnough) { CurrentState = MyDrillStateEnum.Activated; m_lastTimeEjected = MyMinerGame.TotalGamePlayTimeInMilliseconds; SetDrillScale(0.01f); this.Visible = false; return true; } if (CurrentState == MyDrillStateEnum.Activated && m_fullyEjected && ejectedLongAgoEnough) { CurrentState = MyDrillStateEnum.Deactivated; m_lastTimeEjected = MyMinerGame.TotalGamePlayTimeInMilliseconds; } return false; }
public override bool Shot(MyMwcObjectBuilder_SmallShip_Ammo usedAmmo) { if (MySession.Is25DSector) { CurrentState = MyDrillStateEnum.Activated; } if (!m_fullyEjected || GetParentMinerShip().Fuel <= 0 || !GetParentMinerShip().Config.Engine.On) return false; m_lastTimeStarted = MyMinerGame.TotalGamePlayTimeInMilliseconds; CurrentState = MyDrillStateEnum.Drilling; return true; }