private void OnEndDeploy() { if (m_deployState == null) { VsPackage.MessageCentre.StopProgressMsg(); } else { int iSuccessful = Utility.Boolean.BoolToInt(m_deployState.m_deploySuccess); foreach (IVsDeployStatusCallback dsc in m_connectionsDeployStatusCallback) { dsc.OnEndDeploy(iSuccessful); } if (!m_deployState.m_deploySuccess) { m_deployState.m_outputWindowPane.OutputTaskItemString(m_deployState.m_deployOuputMessage, VSTASKPRIORITY.TP_HIGH, VSTASKCATEGORY.CAT_BUILDCOMPILE, null, 0, null, 0, m_deployState.m_deployTaskItem); m_deployState.m_outputWindowPane.FlushToTaskList(); } if (m_deployState.m_deployCallbackControl != null) { m_deployState.m_deployCallbackControl.Dispose(); } m_deployState = null; VsPackage.MessageCentre.StopProgressMsg(iSuccessful != 0 ? DiagnosticStrings.DeploySucceeded : DiagnosticStrings.DeployFailed); } }
public GrantConditionOnDeploy(ActorInitializer init, GrantConditionOnDeployInfo info) : base(info) { self = init.Self; checkTerrainType = info.AllowedTerrainTypes.Count > 0; deployState = init.GetValue <DeployStateInit, DeployState>(DeployState.Undeployed); }
/// <summary> /// 启动定时任务 /// </summary> internal DeployState Start() { if (IsCancel) { return(DeployState.Canceled); } IndexIdentity clientId = new IndexIdentity(); Log log = new Log { Identity = Identity }; bool isLog = true; try { Func <AutoCSer.Net.TcpServer.ReturnValue <Log>, bool> onLog = Server.GetLog(ref Identity, ref clientId) ?? Timer.onLog; log.Type = LogType.CreateBakDirectory; isLog |= onLog(log); (BakDirectory = new DirectoryInfo(Date.NowTime.Set().ToString("yyyyMMddHHmmss_" + Identity.Index.toString() + "_" + Identity.Identity.toString()))).Create(); log.Type = LogType.OnCreateBakDirectory; isLog |= onLog(log); while (TaskIndex != DeployInfo.Tasks.Length && !IsCancel) { Task task = DeployInfo.Tasks.Array[TaskIndex]; log.Set(TaskIndex, task.Type); isLog |= onLog(log); DeployState state = task.Run(this); log.Type = LogType.OnRun; isLog |= onLog(log); if (state != DeployState.Success) { return(state); } ++TaskIndex; } return(DeployState.Success); } catch (Exception error) { Console.WriteLine(error.ToString()); Error = error; } finally { Server.Clear(ref Identity); if (Error == null) { log.Type = LogType.Completed; } else { AutoCSer.Log.Pub.Log.Add(AutoCSer.Log.LogType.Error, Error); log.Type = LogType.Error; } if (!(isLog |= onLog(log))) { Server.ClearClient(ref clientId); } } return(DeployState.Exception); }
public HeliGrantConditionOnDeploy(ActorInitializer init, HeliGrantConditionOnDeployInfo info) : base(info) { self = init.Self; checkTerrainType = info.AllowedTerrainTypes.Count > 0; canTurn = self.Info.HasTraitInfo <IFacingInfo>(); deployState = init.GetValue <DeployStateInit, DeployState>(DeployState.Undeployed); }
/// Execute actions on deflation completion protected virtual void FinishRetract() { Utils.Log("[ModuleDeployableHabitat]: Retract Finished"); deployState = DeployState.Retracted; SetDragCubeState(1.0f); Deployed = false; RefreshPartData(); }
/// Called to start deflation protected virtual void StartRetract() { Utils.Log("[ModuleDeployableHabitat]: Retract Started"); deployState = DeployState.Retracting; SetCrewCapacity(false); DestroyIVA(); RefreshPartData(); }
/// <summary> /// 启动定时任务 /// </summary> internal DeployState Start() { if (IsCancel) { return(DeployState.Canceled); } ClientObject client = DeployInfo.Client; Log log = new Log { DeployIndex = DeployInfo.Index }; bool isLog = true; try { //Func<AutoCSer.Net.TcpServer.ReturnValue<Log>, bool> onLog = Server.GetLog(ref Identity, ref clientId) ?? Timer.onLog; AutoCSer.Net.TcpServer.ServerCallback <Log> onLog = client.OnLog ?? AutoCSer.Net.TcpServer.ServerCallback <Log> .Null.Default; log.Type = LogType.CreateBakDirectory; isLog |= onLog.Callback(log); (BakDirectory = new DirectoryInfo(Server.GetBakDirectoryName(DeployInfo.Index))).Create(); log.Type = LogType.OnCreateBakDirectory; isLog |= onLog.Callback(log); while (TaskIndex != DeployInfo.Tasks.Length && !IsCancel) { ClientTask.Task task = DeployInfo.Tasks.Array[TaskIndex]; log.Set(TaskIndex, task.Type); isLog |= onLog.Callback(log); DeployState state = task.Call(this); log.Type = LogType.OnRun; isLog |= onLog.Callback(log); if (state != DeployState.Success) { return(state); } ++TaskIndex; } return(DeployState.Success); } catch (Exception error) { Console.WriteLine(error.ToString()); Error = error; } finally { //Server.Clear(ref Identity); if (Error == null) { log.Type = LogType.Completed; } else { AutoCSer.Log.Pub.Log.Add(AutoCSer.Log.LogType.Error, Error); log.Type = LogType.Error; } //if (!(isLog |= onLog(log))) Server.ClearClient(ref clientId); } return(DeployState.Exception); }
void OnUndeployStarted() { foreach (var up in info.DeployedUpgrades) { manager.RevokeUpgrade(self, up, this); } deployState = DeployState.Deploying; }
void OnUndeployCompleted() { foreach (var up in info.UndeployedUpgrades) { manager.GrantUpgrade(self, up, this); } deployState = DeployState.Undeployed; }
void OnDeployCompleted() { if (!string.IsNullOrEmpty(Info.DeployedCondition) && deployedToken == Actor.InvalidConditionToken) { deployedToken = self.GrantCondition(Info.DeployedCondition); } deployState = DeployState.Deployed; }
void OnUndeployStarted() { if (deployedToken != Actor.InvalidConditionToken) { deployedToken = self.RevokeCondition(deployedToken); } deployState = DeployState.Deploying; }
/// Called to start deploy protected virtual void StartDeploy() { Utils.Log("[ModuleDeployableHabitat]: Deploy Started"); deployState = DeployState.Deploying; if (HighLogic.LoadedSceneIsFlight && DeployResource != "") { part.RequestResource(DeployResource, (double)DeployResourceAmount); } }
void OnUndeployStarted() { if (deployedToken != ConditionManager.InvalidConditionToken) { deployedToken = conditionManager.RevokeCondition(self, deployedToken); } deployState = DeployState.Deploying; }
void OnUndeployCompleted() { if (conditionManager != null && !string.IsNullOrEmpty(Info.UndeployedCondition) && undeployedToken == ConditionManager.InvalidConditionToken) { undeployedToken = conditionManager.GrantCondition(self, Info.UndeployedCondition); } deployState = DeployState.Undeployed; }
void OnUndeployCompleted() { if (undeployedToken == Actor.InvalidConditionToken) { undeployedToken = self.GrantCondition(Info.UndeployedCondition); } deployState = DeployState.Undeployed; }
/// Execute actions on deploy completion protected virtual void FinishDeploy() { Utils.Log("[ModuleDeployableHabitat]: Deploy Finished"); deployState = DeployState.Deployed; Deployed = true; SetCrewCapacity(Deployed); CreateIVA(); RefreshPartData(); }
public GrantConditionOnDeploy(ActorInitializer init, GrantConditionOnDeployInfo info) { self = init.Self; Info = info; checkTerrainType = info.AllowedTerrainTypes.Count > 0; canTurn = self.Info.HasTraitInfo <IFacingInfo>(); if (init.Contains <DeployStateInit>()) { deployState = init.Get <DeployStateInit, DeployState>(); } }
/// <summary> /// 判断部署是否需要清理操作 /// </summary> /// <param name="state"></param> /// <returns></returns> private static bool checkIsClear(DeployState state) { switch (state) { case DeployState.Success: case DeployState.Canceled: case DeployState.Exception: return(true); } return(false); }
internal void HandleDrop(Transform transform, Transform spawn, bool isGrounded) { if (deployState == DeployState.Dropping && spawn != null) { transform.position = new Vector3(spawn.position.x, transform.position.y, transform.position.z); } if (isGrounded) { deployState = DeployState.Finished; } }
private void UpdateFSM() { switch (deployState) { case DeployState.EXTENDED: SetDragCubeWeight(1f); break; case DeployState.RETRACTED: SetDragCubeWeight(0f); break; case DeployState.EXTENDING: if (anim[animationName].normalizedTime >= 1.0) { anim.Stop(animationName); deployState = DeployState.EXTENDED; part.ScheduleSetCollisionIgnores(); onAnimationStop.Fire(1f); savedAnimationTime = 1.0f; Events["RetractEvent"].active = true; statusDisplay = Localizer.Format("#LOC_B10_MMSEV_Status_Extended"); } else { statusDisplay = Localizer.Format("#LOC_B10_MMSEV_Status_Extending"); } SetDragCubeWeight(1f - anim[animationName].normalizedTime); break; case DeployState.RETRACTING: if (anim[animationName].normalizedTime <= 0.0) { anim.Stop(animationName); deployState = DeployState.RETRACTED; part.ScheduleSetCollisionIgnores(); Events["ExtendEvent"].active = true; onAnimationStop.Fire(0f); savedAnimationTime = 0.0f; statusDisplay = Localizer.Format("#LOC_B10_MMSEV_Status_Retracted"); } else { statusDisplay = Localizer.Format("#LOC_B10_MMSEV_Status_Retracting"); } SetDragCubeWeight(1f - anim[animationName].normalizedTime); break; case DeployState.BROKEN: statusDisplay = Localizer.Format("#LOC_B10_MMSEV_Status_Broken"); break; } }
public GrantConditionOnDeploy(ActorInitializer init, GrantConditionOnDeployInfo info) { self = init.Self; this.info = info; checkTerrainType = info.AllowedTerrainTypes.Count > 0; canTurn = self.Info.HasTraitInfo <IFacingInfo>(); body = Exts.Lazy(self.TraitOrDefault <WithSpriteBody>); if (init.Contains <DeployStateInit>()) { deployState = init.Get <DeployStateInit, DeployState>(); } }
public DeployToUpgrade(ActorInitializer init, DeployToUpgradeInfo info) { this.self = init.Self; this.info = info; manager = self.Trait <UpgradeManager>(); checkTerrainType = info.AllowedTerrainTypes.Count > 0; canTurn = self.Info.HasTraitInfo <IFacingInfo>(); body = Exts.Lazy(self.TraitOrDefault <WithSpriteBody>); if (init.Contains <DeployStateInit>()) { deployState = init.Get <DeployStateInit, DeployState>(); } }
public StatusFile(string siteName) { _siteName = siteName; _filePath = Path.Combine( Environment.Instance.SiteReplicatorPath, siteName); _filePath = Path.Combine(_filePath, "status.xml"); _state = DeployState.NotStarted; StartTime = DateTime.MinValue; EndTime = DateTime.MinValue; }
void OnUndeployCompleted() { if (!string.IsNullOrEmpty(Info.UndeployedCondition) && undeployedToken == Actor.InvalidConditionToken) { undeployedToken = self.GrantCondition(Info.UndeployedCondition); } if (Info.TakeOffOnUndeploy) { self.QueueActivity(new Fly(self, Target.FromCell(self.World, self.Location))); } deployState = DeployState.Undeployed; }
internal void Extend(Interactive other, Rigidbody2D rb, Transform transform) { if (extended) { return; } extended = true; other.SpringLaunch(isSpring: true); deployState = DeployState.Finished; deathTime = TimeKeeper.GetTime() + deathDelay; rb.velocity = new Vector2(extensionForceX, extensionForceY); transform.localScale = new Vector3(transform.localScale.x, transform.localScale.y * 2, transform.localScale.z); }
public virtual void Destroy() { if (!isBreakable) { return; } if (!hasBreakingTransform || deployState == DeployState.BROKEN || CheatOptions.NoCrashDamage) { return; } if (hasAnimation && anim.isPlaying) { anim.Stop(animationName); } GameObject breakGameObject = Instantiate(breakTransform.gameObject, breakTransform.position, breakTransform.rotation, null); List <Transform> childs = breakGameObject.GetComponentsInChildren <Transform>(false).Where(t => t.name != breakName).ToList(); breakTransform.gameObject.SetActive(false); foreach (Transform child in childs) { physicalObject physicBreakObject = physicalObject.ConvertToPhysicalObject(part, child.gameObject); Vector3 randomAngularVelocity = new Vector3(UnityEngine.Random.Range(0.0f, 3.5f), UnityEngine.Random.Range(0.0f, 3.5f), UnityEngine.Random.Range(0.0f, 3.5f)); Vector3 randomVelocity = new Vector3(UnityEngine.Random.Range(0.0f, 3.0f), UnityEngine.Random.Range(0.0f, 3.0f), UnityEngine.Random.Range(0.0f, 3.0f)); physicBreakObject.rb.mass = 0.02f; physicBreakObject.rb.useGravity = false; physicBreakObject.rb.velocity = part.Rigidbody.velocity + randomVelocity; physicBreakObject.rb.angularVelocity = part.Rigidbody.angularVelocity + randomAngularVelocity; physicBreakObject.rb.maxAngularVelocity = PhysicsGlobals.MaxAngularVelocity; physicBreakObject.origDrag = 0.02f; StartCoroutine(RemovePhysicalObject(child.gameObject)); } deployState = DeployState.BROKEN; statusDisplay = Localizer.Format("#LOC_B10_MMSEV_Status_Broken"); part.ResetCollisions(); Events["RetractEvent"].active = false; Events["ExtendEvent"].active = false; Events["RepairEvent"].active = true; }
/// Sets up the first load of the module protected void SetupState() { SetCrewCapacity(Deployed); if (Deployed) { deployState = DeployState.Deployed; deployAnimation.normalizedTime = 0.0f; CreateIVA(); } else { deployState = DeployState.Retracted; deployAnimation.normalizedTime = 1.0f; DestroyIVA(); } RefreshPartData(); }
public void Extend() { if (deployState == DeployState.BROKEN) { return; } if (anim != null) { anim[animationName].speed = HighLogic.LoadedSceneIsEditor ? animationSpeed * 10 : animationSpeed; anim[animationName].normalizedTime = 0.0f; anim[animationName].enabled = true; anim.Play(animationName); deployState = DeployState.EXTENDING; Events["ExtendEvent"].active = false; onAnimationStart.Fire(0f, 1f); } }
public void Retract() { if (deployState == DeployState.BROKEN) { return; } if (anim != null) { anim[animationName].speed = HighLogic.LoadedSceneIsEditor ? -animationSpeed * 10 : -animationSpeed; anim[animationName].normalizedTime = 1.0f; anim[animationName].enabled = true; anim.Play(animationName); deployState = DeployState.RETRACTING; Events["RetractEvent"].active = false; onAnimationStart.Fire(1f, 0f); } }
public override void OnStart(StartState state) { base.OnStart(state); onAnimationStart = new EventData <float, float>(animationName); onAnimationStop = new EventData <float>(animationName); if (!string.IsNullOrEmpty(breakName)) { breakTransform = part.FindModelTransform(breakName); if (breakTransform == null) { Debug.LogError($"[{MODULENAME}] Could not find breakTransform '{breakName}' on part '{part.name}' "); } else { hasBreakingTransform = true; } } if (!string.IsNullOrEmpty(animationName)) { anim = part.FindModelAnimator(animationName); if (anim == null) { Debug.LogError($"[{MODULENAME}] Could not find animation '{animationName}' on part '{part.name}' "); deployState = DeployState.EXTENDED; hasAnimation = false; statusDisplay = "-"; } } else { deployState = DeployState.EXTENDED; hasAnimation = false; statusDisplay = "-"; } StartFSM(); }
/// <summary> /// Do all operations related to deploing drill (or hiding it) - animation /// </summary> private void HandleDeployment(float dt, bool down = true) { if (DrillDeploymentState != DeployState.Idle) { float Rotation = dt * 3.75f; Cyl1Transform.RotateAroundLocal(new Vector3(0, 1, 0), Rotation); Cyl2Transform.RotateAroundLocal(new Vector3(0, 1, 0), Rotation); Cyl3Transform.RotateAroundLocal(new Vector3(0, 1, 0), Rotation); } switch (DrillDeploymentState) { case DeployState.Idle: { if (down) DrillDeploymentState = DeployState.DeployBase; } break; case DeployState.DeployBase: { Vector3 Translation = new Vector3(-dt * 0.35f, 0, 0); BaseTransform.localPosition += (down ? Translation : -Translation); //BaseTransform.collider.transform.localPosition += Translation; if (down) { if (BaseTransform.localPosition.x <= -0.35) { BaseTransform.localPosition = new Vector3(-0.35f, BaseTransform.localPosition.y, BaseTransform.localPosition.z); //BaseTransform.collider.transform.localPosition.Set(-0.25f, 0, 0); DrillDeploymentState = DeployState.DeployArm1; } } else { if (BaseTransform.localPosition.x >= -0.0521) { BaseTransform.localPosition = new Vector3(-0.0521f, BaseTransform.localPosition.y, BaseTransform.localPosition.z); //BaseTransform.collider.transform.localPosition.Set(-0.25f, 0, 0); DrillDeploymentState = DeployState.Idle; } } } break; case DeployState.DeployArm1: { float Speed = (!IsDrillUndergorund ? 0.5f : 0.2f); Vector3 Translation = new Vector3(0, -dt * Speed, 0); Cyl1Transform.localPosition += (down ? Translation : -Translation); //Cyl1Transform.collider.transform.localPosition += Translation; if (down) { if (Cyl1Transform.localPosition.y <= -0.399f) { Cyl1Transform.localPosition = new Vector3(Cyl1Transform.localPosition.x, -0.399f, Cyl1Transform.localPosition.z); //Cyl1Transform.collider.transform.localPosition.Set(-5, 0, 0); DrillDeploymentState = DeployState.DeployArm2; } } else { if (Cyl1Transform.localPosition.y >= 0.417346f) { Cyl1Transform.localPosition = new Vector3(Cyl1Transform.localPosition.x, 0.417346f, Cyl1Transform.localPosition.z); //Cyl1Transform.collider.transform.localPosition.Set(-5, 0, 0); DrillDeploymentState = DeployState.DeployBase; } } } break; case DeployState.DeployArm2: { float Speed = (!IsDrillUndergorund ? 0.5f : 0.2f); Vector3 Translation = new Vector3(0, -dt * Speed, 0); Cyl2Transform.localPosition += (down ? Translation : -Translation); //Cyl2Transform.collider.transform.localPosition += Translation; if (down) { if (Cyl2Transform.localPosition.y <= -0.899f) { Cyl2Transform.localPosition = new Vector3(Cyl2Transform.localPosition.x, -0.899f, Cyl2Transform.localPosition.z); //Cyl1Transform.collider.transform.localPosition.Set(-5, 0, 0); DrillDeploymentState = DeployState.DeployArm3; } } else { if (Cyl2Transform.localPosition.y >= -0.01016799f) { Cyl2Transform.localPosition = new Vector3(Cyl2Transform.localPosition.x, -0.01016799f, Cyl2Transform.localPosition.z); //Cyl1Transform.collider.transform.localPosition.Set(-5, 0, 0); DrillDeploymentState = DeployState.DeployArm1; } } } break; case DeployState.DeployArm3: { float Speed = (!IsDrillUndergorund ? 0.5f : 0.2f); Vector3 Translation = new Vector3(0, -dt * Speed, 0); Cyl3Transform.localPosition += (down ? Translation : -Translation); //Cyl2Transform.collider.transform.localPosition += Translation; if (down) { if (Cyl3Transform.localPosition.y <= -0.899f) { Cyl3Transform.localPosition = new Vector3(Cyl3Transform.localPosition.x, -0.899f, Cyl3Transform.localPosition.z); //Cyl1Transform.collider.transform.localPosition.Set(-5, 0, 0); DrillDeploymentState = DeployState.Deployed; } } else { if (Cyl3Transform.localPosition.y >= 0.037) { Cyl3Transform.localPosition = new Vector3(Cyl3Transform.localPosition.x, 0.037f, Cyl3Transform.localPosition.z); //Cyl1Transform.collider.transform.localPosition.Set(-5, 0, 0); DrillDeploymentState = DeployState.DeployArm2; } } } break; case DeployState.Deployed: { if (down == false) DrillDeploymentState = DeployState.DeployArm3; } break; } DeployLength = Math.Abs(Cyl1Transform.localPosition.y - 0.417346f) + Math.Abs(Cyl2Transform.localPosition.y + 0.01016799f) + Math.Abs(Cyl3Transform.localPosition.y - 0.037f); }
int IVsDeployableProjectCfg.StartDeploy(IVsOutputWindowPane pIVsOutputWindowPane, uint dwOptions) { VsPackage.MessageCentre.ClearDeploymentMsgs(); VsPackage.MessageCentre.StartProgressMsg(DiagnosticStrings.StartDeploy); VsPackage.MessageCentre.DeploymentMsg(string.Format(DiagnosticStrings.LookingUpDevice, this.DeployTransportName)); int hr; m_deployState = new DeployState(); m_deployState.m_outputWindowPane = pIVsOutputWindowPane; foreach (IVsDeployStatusCallback dsc in m_connectionsDeployStatusCallback) { int iContinue = Utility.Boolean.TRUE; dsc.OnStartDeploy(ref iContinue); m_deployState.m_deploySuccess = m_deployState.m_deploySuccess && (iContinue == Utility.Boolean.TRUE); } DebugPort port = GetDebugPort(); if (port == null) SetDeployFailure(string.Format("Invalid device transport setting '{0}', could not find a debug port", this.DeployTransportName)); else VsPackage.MessageCentre.DeploymentMsg(string.Format( DiagnosticStrings.FoundDevicePort, port.Name, port.PortId, port.PortFilter)); hr = m_deployState.m_deploySuccess ? Utility.COM_HResults.S_OK : Utility.COM_HResults.E_FAIL; if (m_deployState.m_deploySuccess && !port.IsLocalPort) { m_deployState.m_deployCallbackControl = new System.Windows.Forms.Control(); m_deployState.m_deployCallbackControl.CreateControl(); m_deployState.m_threadDeploy = new Thread(delegate() { try { Deploy(port); } catch (Exception ex) { SetDeployFailure("An error has occurred: please check your hardware.", "An error has occurred: please check your hardware.\n" + ex.Message + "\n" + "Source: " + ex.Source + "\n" + "Stack : \n" + ex.StackTrace + "\n" ); } m_deployState.m_deployCallbackControl.Invoke(new DeployState.EndDeployDelegate(OnEndDeploy)); }); m_deployState.m_threadDeploy.Start(); } else { OnEndDeploy(); } return hr; }
public RocketDeploy(GameScreen screen, Player player) : base(screen.Game) { this.Screen = screen; this.player = player; Screen.Game.Content.Load<Model>("Models/rocket");//preload; this.state = DeployState.Waiting; }
public void LoadOrCreate() { XmlDocument doc = new XmlDocument(); XPathNavigator nav = null; bool hasMore; int num; if (!FileHelper.FileSystem.File.Exists(_filePath)) { Save(); return; } using (Stream stream = FileHelper.FileSystem.File.OpenRead(_filePath)) { doc = new XmlDocument(); doc.Load(stream); } nav = doc.CreateNavigator(); nav.MoveToFirstChild(); hasMore = nav.MoveToFirstChild(); while (hasMore) { if (string.Equals(nav.Name, "state", StringComparison.OrdinalIgnoreCase)) { DeployState status = DeployState.NotStarted; if (Enum.TryParse<DeployState>(nav.Value, true, out status)) { State = status; } } else if (string.Equals(nav.Name, "startTime", StringComparison.OrdinalIgnoreCase)) { DateTime startTime = DateTime.MinValue; if (DateTime.TryParse(nav.Value, out startTime)) { StartTime = startTime; } } else if (string.Equals(nav.Name, "endTime", StringComparison.OrdinalIgnoreCase)) { DateTime endTime = DateTime.MinValue; if (DateTime.TryParse(nav.Value, out endTime)) { EndTime = endTime; } } else if (string.Equals(nav.Name, "complete", StringComparison.OrdinalIgnoreCase)) { bool complete; if (bool.TryParse(nav.Value, out complete)) { Complete = complete; } } else if (string.Equals(nav.Name, "objectsAdded", StringComparison.OrdinalIgnoreCase)) { if (int.TryParse(nav.Value, out num)) { ObjectsAdded = num; } } else if (string.Equals(nav.Name, "objectsUpdated", StringComparison.OrdinalIgnoreCase)) { if (int.TryParse(nav.Value, out num)) { ObjectsUpdated = num; } } else if (string.Equals(nav.Name, "objectsDeleted", StringComparison.OrdinalIgnoreCase)) { if (int.TryParse(nav.Value, out num)) { ObjectsDeleted = num; } } else if (string.Equals(nav.Name, "parametersChanged", StringComparison.OrdinalIgnoreCase)) { if (int.TryParse(nav.Value, out num)) { ParametersChanged = num; } } else if (string.Equals(nav.Name, "bytesCopied", StringComparison.OrdinalIgnoreCase)) { long longNum; if (long.TryParse(nav.Value, out longNum)) { BytesCopied = longNum; } } hasMore = nav.MoveToNext(); } }
public void Deploy() { if (this.state == DeployState.Waiting) { this.state = DeployState.Deploying; this.time = DeployTime; this.current = new Rocket(Screen, player.Position); this.UpdateWorld(); current.Initialize(); Screen.Components.Add(current); } }
public void Update() { var dt = Time.deltaTime; var down = ArmWantToGoDown; if (DrillDeploymentState != DeployState.Idle) { float Rotation = dt * 3.75f; Cyl1Transform.Rotate(new Vector3(0, 1, 0), Rotation); Cyl2Transform.Rotate(new Vector3(0, 1, 0), Rotation); Cyl3Transform.Rotate(new Vector3(0, 1, 0), Rotation); } switch (DrillDeploymentState) { case DeployState.Idle: { if (down) DrillDeploymentState = DeployState.DeployBase; } break; case DeployState.DeployBase: { Vector3 Translation = new Vector3(-dt * 0.35f, 0, 0); BaseTransform.localPosition += (down ? Translation : -Translation); if (down) { if (BaseTransform.localPosition.x <= -0.35) { BaseTransform.localPosition = new Vector3(-0.35f, BaseTransform.localPosition.y, BaseTransform.localPosition.z); DrillDeploymentState = DeployState.DeployArm1; } } else { if (BaseTransform.localPosition.x >= -0.0521) { BaseTransform.localPosition = new Vector3(-0.0521f, BaseTransform.localPosition.y, BaseTransform.localPosition.z); DrillDeploymentState = DeployState.Idle; } } } break; case DeployState.DeployArm1: { float Speed = 0.5f; Vector3 Translation = new Vector3(0, -dt * Speed, 0); Cyl1Transform.localPosition += (down ? Translation : -Translation); if (down) { if (Cyl1Transform.localPosition.y <= -0.399f) { Cyl1Transform.localPosition = new Vector3(Cyl1Transform.localPosition.x, -0.399f, Cyl1Transform.localPosition.z); DrillDeploymentState = DeployState.DeployArm2; } } else { if (Cyl1Transform.localPosition.y >= 0.417346f) { Cyl1Transform.localPosition = new Vector3(Cyl1Transform.localPosition.x, 0.417346f, Cyl1Transform.localPosition.z); DrillDeploymentState = DeployState.DeployBase; } } } break; case DeployState.DeployArm2: { float Speed = 0.5f; Vector3 Translation = new Vector3(0, -dt * Speed, 0); Cyl2Transform.localPosition += (down ? Translation : -Translation); if (down) { if (Cyl2Transform.localPosition.y <= -0.899f) { Cyl2Transform.localPosition = new Vector3(Cyl2Transform.localPosition.x, -0.899f, Cyl2Transform.localPosition.z); DrillDeploymentState = DeployState.DeployArm3; } } else { if (Cyl2Transform.localPosition.y >= -0.01016799f) { Cyl2Transform.localPosition = new Vector3(Cyl2Transform.localPosition.x, -0.01016799f, Cyl2Transform.localPosition.z); DrillDeploymentState = DeployState.DeployArm1; } } } break; case DeployState.DeployArm3: { float Speed = 0.5f; Vector3 Translation = new Vector3(0, -dt * Speed, 0); Cyl3Transform.localPosition += (down ? Translation : -Translation); if (down) { if (Cyl3Transform.localPosition.y <= -0.899f) { Cyl3Transform.localPosition = new Vector3(Cyl3Transform.localPosition.x, -0.899f, Cyl3Transform.localPosition.z); DrillDeploymentState = DeployState.Deployed; } } else { if (Cyl3Transform.localPosition.y >= 0.037) { Cyl3Transform.localPosition = new Vector3(Cyl3Transform.localPosition.x, 0.037f, Cyl3Transform.localPosition.z); DrillDeploymentState = DeployState.DeployArm2; } } } break; case DeployState.Deployed: { if (down == false) DrillDeploymentState = DeployState.DeployArm3; } break; } }
public override void Update(GameTime gameTime) { float dt = (float)gameTime.ElapsedGameTime.TotalSeconds; if (this.time > 0) this.time -= dt; if (this.state == DeployState.Deploying) { this.UpdateWorld(); if (this.time <= 0) { time = RechargeTime; this.state = DeployState.Recharging; this.current.Fire(); this.current = null; } } if (this.state == DeployState.Recharging && this.time <= 0) this.state = DeployState.Waiting; base.Update(gameTime); }