private void calcUpByLegs() { Vector3 mid = new Vector3(); for (int i = 0; i < moveen.engine.steps.Count; i++) { mid += moveen.engine.steps[i].bestTargetProgressiveAbs; // mid += moveen.engine.steps[i].legPosAbs.v; } mid /= moveen.engine.steps.Count; upByLegs = new Vector3(); for (int i = 0; i < moveen.engine.steps.Count; i++) { Step2 step = moveen.engine.steps[i]; Vector3 vec = step.bestTargetProgressiveAbs.sub(mid); if (!step.dockedState) { vec = vec.mul(0.5f); } // Vector3 vec = step.legPosAbs.v.sub(mid); upByLegs += vec.crossProduct(new Vector3(0, 1, 0)).crossProduct(vec).normalized; } upByLegs = upByLegs.normalized(); }
private static void Run() { Step1.Run(); Step2.Run(); Step3.Run(); Step4.Run(); }
public void Save(IniParser ini, string section) { ini.AddSetting(section, "Enabled", Enabled); ini.AddSetting(section, "ID", ID.ToString()); ini.AddSetting(section, "Alias", Alias.ToString()); ini.AddSetting(section, "Multihex", Multihex.ToString()); ini.AddSetting(section, "Aim", Aim); ini.AddSetting(section, "Armor", Armor); ini.AddSetting(section, "Rotate", Rotate); ini.AddSetting(section, "Walk", Walk.ToString()); ini.AddSetting(section, "Run", Run.ToString()); ini.AddSetting(section, "Step1", Step1.ToString()); ini.AddSetting(section, "Step2", Step2.ToString()); ini.AddSetting(section, "Step3", Step3.ToString()); ini.AddSetting(section, "Step4", Step4.ToString()); if (Sound.Length > 0) { ini.AddNewSetting(section, "Sound", Sound); } else { ini.DeleteSetting(section, "Sound"); } if (Comment.Length > 0) { ini.AddNewSetting(section, "Comment", Comment); } else { ini.DeleteSetting(section, "Comment"); } }
// Update is called once per frame void Update() { _timer += Time.deltaTime; if (PlayStepSounds && (_timer > stepDelay) && (_playerRB.velocity.x * _playerRB.velocity.x) > 0) { int caseValue = Random.Range(0, 5); switch (caseValue) { case 1: Step1.Play(); break; case 2: Step2.Play(); break; case 3: Step3.Play(); break; case 4: Step4.Play(); break; } _timer = 0; } }
void IWizardControl.RefreshContent() { txtSummary.Text = ""; txtSummary.Text += Step1.ToString() + Environment.NewLine; txtSummary.Text += Step3.ToString() + Environment.NewLine; txtSummary.Text += Step2.ToString() + Environment.NewLine; }
public void Approval_StandardMonAppvTextron_WS_927() { if (!DataParser.ReturnExecution("WS_927")) { Assert.Ignore(); } else { _file = "Resources\\" + client + "\\TestsData\\WS_927.xml"; string user = AwardData.GetAwardUserName(_file), award = AwardData.GetAwardName(_file), secondAward = AwardData.GetSecondAwardName(_file), populationImpact = AwardData.GetAwardPopulationImpact(_file), financialImpact = AwardData.GetAwardFinancialImpact(_file), bussinesImpact = AwardData.GetAwardBussinesImpact(_file), amount = AwardData.GetAwardAmountValue(_file), objetives = AwardData.GetAwardObjetives(_file), printype = AwardData.GetAwardDeliverType(_file), msg = AwardData.GetAwardMessage(_file), projectTask = AwardData.GetAwardProjectTask(_file), reason = AwardData.GetAwardReason(_file), proxy_name = ProxyData.GetProxyUserName(_file), approval_name = AwardData.GetApprovalUserName(_file); ProxyHomePage proxyPage = InitialPage.Go().Logon().ClickLogin().NavigateToAdminHomePage() .LoginProxyAsuser().EnterUserName(user); MainHomePage home = proxyPage.ProxyToMainHomePage(); Assert.AreEqual("You are proxied in under: " + user, home.GetProxyLoginMsg(), "The message of proxy login is not correct"); Step2 step2 = home.NavigateToNomination() .SearchEmployeeFound(proxy_name) .SelectAward(award) .SelectValues(populationImpact) .SelectValues(financialImpact) .SelectValues(bussinesImpact) .ClickNextSameStep(); Assert.AreEqual("Appreciation Award", step2.GetAwardName("Appreciation Award"), "Award is not the same as expected"); Assert.AreEqual("Honors Award", step2.GetAwardName("Honors Award"), "Award is not the same as expected"); Assert.AreEqual("Excellence Award", step2.GetAwardName("Excellence Award"), "Award is not the same as expected"); Assert.AreEqual("Distinction Award", step2.GetAwardName("Distinction Award"), "Award is not the same as expected"); NominationHomePage recognitionPage = step2.SelectSecondAward(secondAward).SelectValueOfAward(amount) .SelectProjectTask(projectTask) .CheckProjectApproval() .SelectValues(objetives) .FillMsg(msg) .FillReason(reason) .ClickNext(); recognitionPage.DeliverType(printype); Assert.AreEqual(2, recognitionPage.GetCountEditLnk(), "Edit links are not two"); recognitionPage.ClickSendRecognition(); Assert.AreEqual("Success!", recognitionPage.GetSuccesMsg(), "Message its not success"); AdminHomePage proxy = recognitionPage.ExitProxy(); home = proxy.LoginProxyAsuser().EnterUserName(approval_name).ProxyToMainHomePage(); Assert.IsTrue(home.IsPopUpRecognitionShow(), "Pop up recognition is not showing up"); PendingApprovals pending = home.ClickHereAwardPopUp(); Assert.AreEqual("Pending Approvals", pending.GetTitleMenu(), "Title is not pending approval"); pending.ApproveAward().ClickApprove(); proxy = pending.ExitProxy(); home = proxy.LoginProxyAsuser().EnterUserName(proxy_name).ProxyToMainHomePage(); MyAwards awards = home.ClosePopUp().NavigateToMyAwards(); Assert.AreEqual(secondAward, awards.GetAwardName(1, 6), "The last award that someone gave you is not present"); awards.OpenDetailsAward(1, 7); } }
private Challenge ProcessStep1(XmppStream stream, Response response, XmppHandlerContext ctx) { var step = new Step2(response.TextBase64); var userName = step.Username; var user = ctx.UserManager.GetUser(new Jid(userName, stream.Domain, null)); log.DebugFormat("User {0} {1}. Realm={2}", userName, user == null ? "not found" : user.ToString(), step.Realm); if (user != null && string.Compare(stream.Domain, step.Realm, StringComparison.OrdinalIgnoreCase) == 0 && user.Sid == null) { if (step.Authorize(userName, user.Password)) { log.DebugFormat("User authorized"); lock (authData) { authData[stream.Id].UserName = userName; } var challenge = new Challenge(); challenge.TextBase64 = string.Format("rspauth={0}", step.GenerateResponse(userName, user.Password, string.Empty)); return(challenge); } else { log.DebugFormat("User not authorized"); } } return(null); }
public ActionResult Step2(Step2 step2) { if (!ModelState.IsValid) { return View(); } return Redirect("/Home/Step3"); }
public Form1() { InitializeComponent(); Step2.Hide(); Step3.Hide(); btn_showLayout.Text = "Go Through All Steps"; btn_showLayout.Enabled = false; }
public void Recognition_RealTimeValidation_WS_1161() { if (!DataParser.ReturnExecution("WS_1161")) { Assert.Ignore(); } else { _file = "Resources\\" + client + "\\TestsData\\WS_1161.xml"; string user = AwardData.GetAwardUserName(_file), user1 = AwardData.GetAwardUserName1(_file) , user2 = AwardData.GetAwardUserName2(_file), user3 = AwardData.GetAwardUserName3(_file), user4 = AwardData.GetAwardUserName4(_file), user5 = AwardData.GetAwardUserName5(_file), proxy_name = ProxyData.GetProxyUserName(_file); //Scenario 1 NominationHomePage recognitionPage = InitialPage.Go().EnterId(client).EnterId(client).Logon().ClickLogin().NavigateToNominationSpan(); recognitionPage.ClickMultipleRecipients() .SearchEmployeeFoundMultiple(user) .SearchEmployeeFoundMultiple(user1) .SearchEmployeeFoundMultiple(user2).SearchEmployeeFoundMultiple(user3).ClickNextGeneric(); Assert.IsTrue(recognitionPage.IsStep2Block(), "Step2 is not blocked"); //Scenario 2 MainHomePage mainPage = recognitionPage.NavigateToAdminHomePage() .LoginProxyAsuser() .EnterUserName(proxy_name) .ProxyToMainHomePage(); Step2 ste2 = mainPage.NavigateToNominationSpan().SearchEmployeeFound(user4); Assert.AreEqual("Rave", ste2.GetAwardName("Rave"), "Rave Award is not present"); Assert.AreEqual("Pioneer Award", ste2.GetAwardName("Pioneer Award"), "Pioneer Award is not present"); Assert.AreEqual("Pathfinder Award", ste2.GetAwardName("Pathfinder Award"), "Pathfinder Award is not present"); Assert.AreEqual("Trailblazer Award", ste2.GetAwardName("Trailblazer Award"), "Trailblazer Award is not present"); //Scenario 3 ste2.Refresh(); ste2 = recognitionPage.SearchEmployeeFound(user5); Assert.AreEqual("Rave", ste2.GetAwardName("Rave"), "Rave Award is not present"); Assert.IsFalse(ste2.IsAwardPresent("Pioneer Award"), "Pioneer Award is present"); Assert.IsFalse(ste2.IsAwardPresent("Pathfinder Award"), "Pathfinder Award not present"); Assert.IsFalse(ste2.IsAwardPresent("Trailblazer Award"), "Trailblazer Award not present"); } }
public void StepFive() { Debug.Log("StepFiveInit"); Step0.SetActive(false); Step1.SetActive(false); Step2.SetActive(false); Step3.SetActive(false); Step4.SetActive(false); Step5.SetActive(true); StartButton.SetActive(false); Hide1.SetActive(true); Next1.SetActive(true); Previous1.SetActive(true); }
public void MainMenu() { Step0.SetActive(false); Step1.SetActive(false); Step2.SetActive(false); Step3.SetActive(false); Step4.SetActive(false); Step5.SetActive(false); StartButton.SetActive(true); Hide1.SetActive(false); Next1.SetActive(false); Previous1.SetActive(false); }
public void Should_Use_XmppDomain_As_Default_Realm() { // Arrange string serverStep1 = "nonce=\"3828753646\",qop=\"auth\",charset=utf-8,algorithm=md5-sess"; var step1 = new Step1(serverStep1); var xmppClient = new XmppClient() { Username = "******", XmppDomain = "server.com", Password = "******" }; var step2 = new Step2(step1, xmppClient); // Assert step2.GetMessage().ShouldContain("realm=\"server.com\""); }
public void ProcessOrder(Order o) { var step1 = new Step1(); var step2 = new Step2(); step1.Apply(o); Order order = o; order = o; step2.Apply(order); step1.Apply(order); }
// Use this for initialization void Start() { Time.fixedDeltaTime = 0.5f; Step1.SetActive(false); Step2.SetActive(false); Step3.SetActive(false); Step4.SetActive(false); Step5.SetActive(false); Step6.SetActive(false); Step7.SetActive(false); Step8.SetActive(false); Step9.SetActive(false); currenttime = Time.time; printcount = 0; loop = -1; }
public override void OnInspectorGUI() { Step2 componentStep = component.step; if (componentStep.showTrajectory) { EditorGUILayout.HelpBox("Don't forget to turn off \"showTrajectory\" as it eats editor performance", MessageType.Warning); } DrawDefaultInspector(); MoveenStep2.showInstrumentalInfo = EditorGUILayout.Foldout(MoveenStep2.showInstrumentalInfo, "instrumental info", true); if (MoveenStep2.showInstrumentalInfo) { drawInstrumentalProperties(componentStep); } }
[HttpPost] //select optional public ActionResult Step3(RenderModel model, Step2 param) { var rto = new Step3Model(CurrentPage); DateTime pudate = _functional.ConvertDate(param.pickupdate); DateTime dfdate = _functional.ConvertDate(param.dropoffdate); DateTime putime = _functional.ConvertTime(param.pickuptime); DateTime dftime = _functional.ConvertTime(param.dropofftime); pudate = _functional.MergeDatetime(pudate, putime); dfdate = _functional.MergeDatetime(dfdate, dftime); int ndate = (dfdate - pudate).Days; int nhour = (dfdate - pudate).Hours; int nmin = (dfdate - pudate).Minutes; if (nhour >= 4 && nmin > 1) { ndate += 1; } rto.NumDate = ndate; rto.PickupBranch = DatabaseContext.Database.Fetch <tb_branch>(string.Format("select * from tb_branch where A_ID = {0}", param.pickuploc)).FirstOrDefault(); rto.DropoffBranch = DatabaseContext.Database.Fetch <tb_branch>(string.Format("select * from tb_branch where A_ID = {0}", param.dropoffloc)).FirstOrDefault(); var sql = string.Format(@"Select t1.A_ID,Branch_ID,Car_ID,t2.* From tb_branch_car t1 Inner join tb_car t2 on t1.Car_ID = t2.id Where t1.A_ID = {0} and t1.Status ='A'", param.car_id); rto.Car = DatabaseContext.Database.Fetch <dto_carprice>(sql).FirstOrDefault(); rto.Car.price = _carService.GetCarPriceByid(param.price_id); rto.TotalCarPrice = (rto.Car?.price.price ?? 0) * rto.NumDate; var listextra = string.Join(", ", param.extra ?? new int[] { 0 }); rto.ExtraOption = DatabaseContext.Database.Fetch <tb_optional>(string.Format("select * from tb_optional where A_ID in ({0})", listextra)); rto.TotalExtra = rto.ExtraOption.Sum(x => x.Price) * rto.NumDate; rto.TotalPrice = rto.TotalCarPrice + rto.TotalExtra; return(CurrentTemplate(rto)); }
public void StepOne() { Marker1.SetActive(true); Marker2.SetActive(true); Debug.Log("StepOneInit"); FindObjectOfType <DistanceCalculator>(); Step0.SetActive(false); Step1.SetActive(true); Step2.SetActive(false); Step3.SetActive(false); Step4.SetActive(false); Step5.SetActive(false); StartButton.SetActive(false); Hide1.SetActive(true); Next1.SetActive(true); Previous1.SetActive(false); }
/// <summary> /// 根据流程实际进度做界面显示(去除Step值判断) /// </summary> private void InitStepOn() { List <TaskEntity> list = EDoc2ProcessManager.GetTaskData(IncidentId); TaskEntity endItem = list.FirstOrDefault(i => i.Status == "已完成" && i.StepName == "结束"); if (endItem != null) { Page.Title = FaProcessSteppService.GetStepText(FaProcessStepEnum.Complete); Step2.AddCssClass("on"); return; } TaskEntity cItem = list.FirstOrDefault(i => i.Status == "激活"); if (cItem != null) { FaProcessStepEnum stepEnum = FaProcessSteppService.GetStepVal(cItem.StepName); switch (stepEnum) { case FaProcessStepEnum.Start: Step0.AddCssClass("on"); break; case FaProcessStepEnum.FaLeader: Step1.AddCssClass("on"); break; case FaProcessStepEnum.FaDirector: Step2.AddCssClass("on"); break; case FaProcessStepEnum.Complete: Step3.AddCssClass("on"); break; } Page.Title = FaProcessSteppService.GetStepText(stepEnum); } else { Page.Title = FaProcessSteppService.GetStepText(FaProcessStepEnum.Start); Step0.AddCssClass("on"); } }
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { switch (tabControl1.SelectedIndex) { //case 0: // Page = 1; // Back.Visible = false; // Step1.Focus(); // break; case 0: Page = 2; Back.Visible = true; Step2.Focus(); //清空所有控件 break; case 1: //MessageBox.Show(Application.StartupPath + @"\pic\formingShape\" + Step2select + ".JPG"); if (string.IsNullOrEmpty(Step2select)) { tabControl1.SelectedTab = Step2; MessageBox.Show("Error:Step2未选择!"); Step2.Focus(); return; } //_X0 = ComTransFrom._F(X0.Text); //_Y0 = ComTransFrom._F(Y0.Text); //_Z0 = ComTransFrom._F(Z0.Text); step3Pic.Image = Image.FromFile(Application.StartupPath + @"\pic\formingShape\" + Step2select + ".JPG"); Page = 3; Back.Visible = true; this.step3Pic.Controls.Clear(); step3(); addtextbox(); Step3.Focus(); break; } //MessageBox.Show(Page.ToString()); }
public XmppHandlerResult ProcessElement(Response element, XmppSession session, XmppHandlerContext context) { var authStep = session.AuthData as AuthData; if (authStep == null) { return(Error(session, FailureCondition.temporary_auth_failure)); } if (authStep.Step == AuthStep.Step1) { var step = new Step2(element.TextBase64); var user = context.Storages.Users.GetUser(step.Username); if (user != null && string.Compare(session.Jid.Server, step.Realm, StringComparison.OrdinalIgnoreCase) == 0 && step.Authorize(step.Username, user.Password)) { var challenge = new Challenge { TextBase64 = string.Format("rspauth={0}", step.CalculateResponse(step.Username, user.Password, string.Empty)) }; authStep.DoStep(step.Username); return(Send(session, challenge)); } else { return(Error(session, FailureCondition.not_authorized)); } } else if (authStep.Step == AuthStep.Step2) { session.Authenticate(authStep.UserName); session.Connection.Reset(); return(Send(session, new Success())); } else { return(Error(session, FailureCondition.temporary_auth_failure)); } }
void NextStep() { next.IsEnabled = false; ++currentStep; switch (currentStep) { case 0: pageTransition.TransitionType = Transitions.PageTransitionType.GrowAndFade; var step0 = new Step0(); next.IsEnabled = true; pageTransition.ShowPage(step0); break; case 1: pageTransition.TransitionType = Transitions.PageTransitionType.SlideAndFade; var step1 = new Step1(); step1.Success += OnSuccess; pageTransition.ShowPage(step1); break; case 2: var step2 = new Step2(); step2.Success += OnSuccess; pageTransition.ShowPage(step2); break; case 3: Telestat.CancelGetDialogs(); var step3 = new Step3(); step3.Success += OnSuccess; step3.Failure += OnFailure; pageTransition.ShowPage(step3); break; case 4: var step4 = new Step4(); pageTransition.ShowPage(step4); break; } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Space)) { if (step == 1) { Step1.SetActive(false); Step2.SetActive(true); } if (step == 2) { Step2.SetActive(false); Step3.SetActive(true); } if (step == 3) { SceneManager.LoadScene(1); } step += 1; } }
public void Awards_RemoveFromOtherAppQueue_WS_1111() { if (!DataParser.ReturnExecution("WS_1111")) { Assert.Ignore(); } else { _file = "Resources\\" + client + "\\TestsData\\WS_1111.xml"; string user = AwardData.GetAwardUserName(_file), award = AwardData.GetAwardName(_file), customerImpact = AwardData.GetAwardCustomerImpact(_file), bussinesImpact = AwardData.GetAwardBussinesImpact(_file), printype = AwardData.GetAwardDeliverType(_file), msg = AwardData.GetAwardMessage(_file), reason = AwardData.GetAwardReason(_file), proxy_name = ProxyData.GetProxyUserName(_file), approval_name = AwardData.GetApprovalUserName(_file); Step2 step2 = InitialPage.Go().Logon().ClickLogin().NavigateToNominationSpan() .SearchEmployeeFound(user) .SelectAward(award); Assert.AreEqual("This award is worth $250.00", step2.GetValueAward(), "the message is not right"); NominationHomePage recognitionPage = step2.SelectSameValues(customerImpact, 1) .FillMsg(msg) .FillReason(reason) .ClickNext(); step2.SelectSameValues(bussinesImpact, 0).ClickNext(); recognitionPage.DeliverType(printype); Assert.AreEqual(2, recognitionPage.GetCountEditLnk(), "Edit links are not two"); recognitionPage.ClickSendRecognition(); Assert.AreEqual("Success!", recognitionPage.GetSuccesMsg(), "Message its not success"); MainHomePage home = recognitionPage.NavigateToAdminHomePageSpan().EnterUserName(proxy_name).ProxyToMainHomePage(); Assert.IsTrue(home.IsPopUpRecognitionShow(), "Pop up recognition is not showing up"); PendingApprovals change = home.ClickHereAwardPopUp(); Assert.AreEqual("Pending Approvals", change.GetTitleMenu(), "Title is not pending approval"); change.ApproveAward().ClickApprove(); Assert.AreEqual("Pending Approvals", change.GetTitleMenu(), "Title is not pending approval"); home = change.ExitProxyToMainPage().NavigateToAdminHomePageSpan().NavigateToAdminHomePageSpan().EnterUserName(approval_name).ProxyToMainHomePage(); Assert.IsFalse(home.IsPopUpRecognitionShow(), "Pop up recognition is showing up"); } }
private static void MainSafe(Arguments arguments) { var targetDirectoryPath = arguments.TargetDirectoryPath; IImmutableDictionary <AssemblyShortName, AssemblyDetails> mainAssemblies; IImmutableDictionary <AssemblyShortName, AssemblyDetails> usedRoslynAssemblies; IImmutableDictionary <AssemblyShortName, string> roslynAssemblyPaths; IImmutableDictionary <AssemblyShortName, IImmutableSet <PackageInfo> > roslynPackageMap; IImmutableDictionary <AssemblyShortName, AssemblyDetails> othersReferencedByRoslyn; Step1.CollectMainAssemblies(arguments.SourceProjectAssemblyDirectoryPath, out mainAssemblies); Step2.CollectRoslynAssemblies(arguments.RoslynBinariesDirectoryPath, ref mainAssemblies, out usedRoslynAssemblies, out roslynAssemblyPaths); Step3.CollectRoslynPackageReferences(arguments.RoslynBinariesDirectoryPath, out roslynPackageMap); Step4.CollectRoslynReferences(ref usedRoslynAssemblies, roslynAssemblyPaths, ref mainAssemblies, roslynPackageMap, out othersReferencedByRoslyn); Step5.CleanTargetDirectory(arguments.TargetDirectoryPath); Step6.CopyAssembliesReferencedByRoslyn(othersReferencedByRoslyn, targetDirectoryPath); Step7.CopyRoslynAssemblies(usedRoslynAssemblies, targetDirectoryPath); Step8.RewriteAndCopyMainAssemblies(mainAssemblies, targetDirectoryPath, usedRoslynAssemblies); Step9.UpdateBindingRedirects(arguments.TargetApplicationConfigurationPath, othersReferencedByRoslyn.Values); }
public void Service_AnniversarySubmission_WS_1325() { if (!DataParser.ReturnExecution("WS_1325")) { Assert.Ignore(); } else { _file = "Resources\\" + client + "\\TestsData\\WS_1325.xml"; string msg = AwardData.GetAwardMessage(_file), award = AwardData.GetAwardName(_file), send_type = AwardData.GetAwardDeliverType(_file), proxy_name = ProxyData.GetProxyUserName(_file); MainHomePage proxyPage = InitialPage.Go().Logon().ClickLogin().NavigateToAdminHomePageSpan().ClickOptionProxy("Proxy") .EnterUserNameProxySprint2(proxy_name).ProxyToMainHomePageSprint().ClosePopUp(); Assert.AreEqual("You are proxied in as:" + proxy_name, proxyPage.GetProxyLoginMsgSprint(), "The message of proxy login is not correct"); Assert.AreEqual("Exit Proxy", proxyPage.GetExitMsg(), "The exit proxy link is not present"); Step2 step2 = proxyPage.NavigateToEventCalendar().clickSendAniversaryCard(); var recognitionPage = step2.SelectAward(award).FillMsg(msg).DeliverType(send_type); recognitionPage.ClickSendRecognition(); Assert.AreEqual("Success!", recognitionPage.GetSuccesMsg(), "Message its not success"); } }
public ActionResult RestoreStep2() { bool initialized = PrepareStep2Session(); Step2 step2 = new Step2(); step2.equipment_type = Session["equipment_type"].ToString(); step2.equipment_description = Session["equipment_description"].ToString(); step2.product_identification = Session["product_identification"].ToString(); step2.make = Session["make"].ToString(); step2.frequencies = (List <Frequency>)Session["frequencies"]; step2.name_of_test = Session["name_of_test"].ToString(); step2.country = Session["country"].ToString(); if (Session["application_id"] != null) { step2.application_id = Session["application_id"].ToString(); } else { step2.application_id = ""; } return(Json(new { step2, data_present = true }, JsonRequestBehavior.AllowGet)); }
public void FixedUpdate() { if (!enabled) { return; } if (bodyRigid == null) { return; } if (cam == null) { return; } bool grabInput = focusGrabber != null && focusGrabber.grab; if (Application.isPlaying) { calcUpByLegs(); } float h = 0; int dockedCount = 0; for (int i = 0; i < moveen.engine.steps.Count; i++) { Step2 step = moveen.engine.steps[i]; // if (!step.dockedState) { !!falls through on BM2 as best target can be -100500 // h += step.bestTargetProgressiveAbs.y; //to rise sharper // } else { dockedCount++; h += step.posAbs.y; // } // h += step.bestTargetProgressiveAbs.y; } float targetHeightMultiplier = jumpPreparing ? jumpPrepareHeightMul : jumpInProgress ? jumpTargetHeightMul : 1; h = moveen.engine.steps.Count == 0 ? height : (h / moveen.engine.steps.Count + height * targetHeightMultiplier); float maxSpeed = speed; if (Input.GetKey(KeyCode.LeftShift)) { maxSpeed *= runSpeedMultiplier; moveen.engine.runJumpTime = runJumpTime;//it adds additional jump force on the step } else { moveen.engine.runJumpTime = 0; } moveen.engine.horizontalMotor.maxSpeed = maxSpeed; Vector3 add = new Vector3(); bool movePressed = false; if (jumpStrengthCurTime < jumpPrepareTime) { if (jumpStrengthCurTime > 0) { //set only after space was released (jump started), as while space is pressed jumpStrengthCurTime is 0 moveen.engine.verticalMotor.copyFrom(jumpMotor); jumpInProgress = true; } jumpStrengthCurTime += Time.deltaTime; //revert old value when jump is ended if (jumpStrengthCurTime >= jumpPrepareTime) { moveen.engine.verticalMotor.copyFrom(previousVerticalMotor); jumpInProgress = false; } } //remember value from editor when not jumping if (jumpStrengthCurTime >= jumpPrepareTime) { previousVerticalMotor.copyFrom(moveen.engine.verticalMotor); } if (grabInput) { if (Input.GetKey(KeyCode.Space)) { jumpStrengthCurTime = 0; jumpPreparing = true; } else { jumpPreparing = false; } if (Input.GetKey(KeyCode.W) || debugMoveForward) { add += new Vector3(1, 0, 0); movePressed = true; } if (Input.GetKey(KeyCode.S)) { add += new Vector3(-1, 0, 0); movePressed = true; } if (Input.GetKey(KeyCode.A)) { add += new Vector3(0, 0, 1); movePressed = true; } if (Input.GetKey(KeyCode.D)) { add += new Vector3(0, 0, -1); movePressed = true; } add = add.normalized(); add *= (maxSpeed / moveen.engine.horizontalMotor.distanceToSpeed); //cam local add = MUtil.toAngleAxis(camYaw, new Vector3(0, 1, 0)).rotate(add); //cam local -> global add = bodyRigid.transform.rotation.conjug().rotate(add); //global -> body local if (add.x > 0) { add.x = Math.Min(add.x, maxSpeed); } if (add.x < 0) { add.x = Math.Max(add.x, -maxSpeed * rearSpeedMultiplyer); } if (add.z > 0) { add.z = Math.Min(add.z, maxSpeed * strafeSpeedMultiplyer); } if (add.z < 0) { add.z = Math.Max(add.z, -maxSpeed * strafeSpeedMultiplyer); } // add = transform.rotation.rotate(add); //body local -> global add = bodyRigid.transform.rotation.rotate(add); //body local -> global // transform.position = body.transform.position + body.transform.rotation.rotate(add); } Vector3 newBestTargetPos = moveen.engine.imCenter.add(add).withSetY(h); if (quantCenter) { if (dockedCount == 0 || movePressed || newBestTargetPos.dist(transform.position) > quantSize) { transform.position = newBestTargetPos; } } else { transform.position = newBestTargetPos; } wantedCamera = bodyRigid.position.withSetY(h); // wantedCamera = transform.position.limit(bodyRigid.position.withSetY(h), maxSpeed / 2).withSetY(h);//мерзко дрожит камера на больших скоростях if (grabInput) { float mx = Input.GetAxis("Mouse X") * 0.04f / Time.timeScale; float my = Input.GetAxis("Mouse Y") * -0.04f / Time.timeScale; camPitch = MyMath.clamp(camPitch + my, -1, 1); if (!debugFreezeRotation) { camYaw = MyMath.angleNormalizeSigned(camYaw + mx); //comment to stop reacting on mouse } if (debugRotateRight) { camYaw = MyMath.angleNormalizeSigned(camYaw + 0.3f * 0.05f); //uncomment to add constant rotation for test } } Quaternion yawRoll = MUtil.toAngleAxis(camYaw, new Vector3(0, 1, 0)); Quaternion rotForCameraLook = yawRoll * MUtil.toAngleAxis((float)(Math.PI / 2), new Vector3(0, 1, 0)) * MUtil.toAngleAxis(camPitch, new Vector3(1, 0, 0)); Quaternion rotForCameraPos = yawRoll; Quaternion rotForTarget; // RaycastHit hit; // Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); // Quaternion wantedRot = transform.rotation; // Vector3 hitPoint = new Vector3(); // // bool wasHit = false; // if (grabInput) { // wasHit = Physics.Raycast(ray.origin, ray.direction, out hit); //TODO cached // hitPoint = hit.point; // if (wasHit) { // //lower target, because we are looking from the top, but the actor will be aiming from a side // // but we don't want correct height for walls and terrain //// if (hit.normal.y > 0.5f && hit.point.y > hit.collider.transform.position.y) { //// hitPoint.y = hit.collider.transform.position.y; //// } // //Debug.DrawLine(new Vector3(-100, -100, -100), hitPoint, Color.red); // // if (moveen.engine.imCenter.dist(hitPoint) > 1) { // wantedRot = MUtil.qToAxes(hitPoint - moveen.engine.imCenter, Vector3.up); // } // } else { // hitPoint = ray.origin + ray.direction * 40; // wasHit = true; // } // } // // yawRoll = Quaternion.FromToRotation(moveen.transform.rotation.rotate(Vector3.right), hitPoint.sub(moveen.transform.position)); // rotForCameraPos = yawRoll; // // // //must be after this transform pos/rot change as target can be child of this // if (wasHit && aimTarget != null) aimTarget.position = hitPoint; if (inclineBodyToLegs) { rotForTarget = MUtil.qToAxesYX(Vector3.up.mix(upByLegs, inclineBodyToLegsRatio), yawRoll.rotate(new Vector3(1, 0, 0))); // rotForTarget = MUtil.qToAxes(yawRoll.rotate(new Vector3(1, 0, 0)), upByLegs); } else { rotForTarget = yawRoll * MUtil.toAngleAxis(camPitch * -0.5f, new Vector3(0, 0, 1)); } if (grabInput) { cam.transform.rotation = rotForCameraLook; oldCam = oldCam.mix(wantedCamera, camApproachFactor); cam.transform.position = oldCam + rotForCameraPos.rotate(camPosition); } // float reactionSpeed = bodyRotReactionSpeed; // if (bodyRigid != null) reactionSpeed /= Math.Max(1, bodyRigid.velocity.length() * bodyRotReactionSpeedSpeed); if (dockedCount > 0) { //rotate target only if at least one leg is touching ground float cosOfHalfAngle = (float)Math.Cos(bodyRotReactionSpeed / 2 / 180f * Math.PI); //TODO cache Quaternion rotDif = rotForTarget.rotSub(transform.rotation); if (rotDif.w < 0) { rotDif = rotDif.scale(-1); } if (rotDif.w < cosOfHalfAngle) { rotDif = rotDif.normalizeWithFixedW(cosOfHalfAngle); } transform.rotation = transform.rotation * rotDif; // transform.rotation = rotForTarget; } else { //get rotation from the body when in air // because else - body could accumulate rotation it will be looking weird after grounding transform.rotation = moveen.targetRot; } moveen.targetPos = transform.position; moveen.targetRot = transform.rotation; }
public void FixedUpdate() { if (!enabled) { return; } if (bodyRigid == null) { return; } if (Application.isPlaying) { calcUpByLegs(); } //calc h float h = 0; int dockedCount = 0; for (int i = 0; i < moveen.engine.steps.Count; i++) { Step2 step = moveen.engine.steps[i]; if (!step.dockedState) { h += step.bestTargetProgressiveAbs.y; //to rise sharper } else { dockedCount++; h += step.posAbs.y; } // h += step.bestTargetProgressiveAbs.y; } float targetHeightMultiplier = jumpPreparing ? jumpPrepareHeightMul : jumpInProgress ? jumpTargetHeightMul : 1; h = moveen.engine.steps.Count == 0 ? height : (h / moveen.engine.steps.Count + height * targetHeightMultiplier); moveen.engine.horizontalMotor.maxSpeed = speed; if (jumpStrengthCurTime < jumpPrepareTime) { if (jumpStrengthCurTime > 0) { //set only after space was released (jump started), as while space is pressed jumpStrengthCurTime is 0 moveen.engine.verticalMotor.copyFrom(jumpMotor); jumpInProgress = true; } jumpStrengthCurTime += Time.deltaTime; //revert old value when jump is ended if (jumpStrengthCurTime >= jumpPrepareTime) { moveen.engine.verticalMotor.copyFrom(previousVerticalMotor); jumpInProgress = false; } } //remember value from editor when not jumping if (jumpStrengthCurTime >= jumpPrepareTime) { previousVerticalMotor.copyFrom(moveen.engine.verticalMotor); } Vector3 add = moveDir.normalized; add *= speed / moveen.engine.horizontalMotor.distanceToSpeed; add = bodyRigid.transform.rotation.conjug().rotate(add); //global -> body local //limit forward, strafe, and rear speed if (add.x > 0) { add.x = Math.Min(add.x, speed); } if (add.x < 0) { add.x = Math.Max(add.x, -speed * rearSpeedMultiplyer); } if (add.z > 0) { add.z = Math.Min(add.z, speed * strafeSpeedMultiplyer); } if (add.z < 0) { add.z = Math.Max(add.z, -speed * strafeSpeedMultiplyer); } add = bodyRigid.transform.rotation.rotate(add); //body local -> global Vector3 newBestTargetPos = moveen.engine.imCenter.add(add).withSetY(h); if (quantCenter) { if (dockedCount == 0 || moveDir.length() > 0 || newBestTargetPos.dist(transform.position) > quantSize) { transform.position = newBestTargetPos; } } else { transform.position = newBestTargetPos; } Quaternion rotForTarget; if (inclineBodyToLegs) { Vector3 wantedForward = chassisRot.rotate(Vector3.right); Vector3 wantedUp = chassisRot.rotate(Vector3.up); Vector3 up = wantedUp.mix(upByLegs, inclineBodyToLegsRatio); rotForTarget = MUtil.qToAxesYX(up, wantedForward); } else { rotForTarget = chassisRot; } if (dockedCount > 0) { //rotate target only if at least one leg is touching ground float cosOfHalfAngle = (float)Math.Cos(bodyRotReactionSpeed / 2 / 180f * Math.PI); //TODO cache Quaternion rotDif = rotForTarget.rotSub(transform.rotation); if (rotDif.w < 0) { rotDif = rotDif.scale(-1); } if (rotDif.w < cosOfHalfAngle) { rotDif = rotDif.normalizeWithFixedW(cosOfHalfAngle); } transform.rotation = transform.rotation * rotDif; } else { //get rotation from the body when in air // because else - body could accumulate rotation it will be looking weird after grounding transform.rotation = moveen.targetRot; } moveen.targetPos = transform.position; moveen.targetRot = transform.rotation; }
public void FixedUpdate() { if (!enabled) { return; } if (bodyRigid == null) { return; } if (cam == null) { return; } bool grabInput = focusGrabber != null && focusGrabber.grab; if (Application.isPlaying) { calcUpByLegs(); } float h = 0; int dockedCount = 0; for (int i = 0; i < moveen.engine.steps.Count; i++) { Step2 step = moveen.engine.steps[i]; if (!step.dockedState) { h += step.bestTargetProgressiveAbs.y; //to rise sharper } else { dockedCount++; h += step.posAbs.y; } // h += step.bestTargetProgressiveAbs.y; } float targetHeightMultiplier = jumpPreparing ? jumpPrepareHeightMul : jumpInProgress ? jumpTargetHeightMul : 1; h = moveen.engine.steps.Count == 0 ? height : (h / moveen.engine.steps.Count + height * targetHeightMultiplier); float maxSpeed = speed; if (Input.GetKey(KeyCode.LeftShift)) { maxSpeed *= runSpeedMultiplier; moveen.engine.runJumpTime = runJumpTime;//it adds additional jump force on the step } else { moveen.engine.runJumpTime = 0; } moveen.engine.horizontalMotor.maxSpeed = maxSpeed; Vector3 add = new Vector3(); bool movePressed = false; if (jumpStrengthCurTime < jumpPrepareTime) { if (jumpStrengthCurTime > 0) { //set only after space was released (jump started), as while space is pressed jumpStrengthCurTime is 0 moveen.engine.verticalMotor.copyFrom(jumpMotor); jumpInProgress = true; } jumpStrengthCurTime += Time.deltaTime; //revert old value when jump is ended if (jumpStrengthCurTime >= jumpPrepareTime) { moveen.engine.verticalMotor.copyFrom(previousVerticalMotor); jumpInProgress = false; } } //remember value from editor when not jumping if (jumpStrengthCurTime >= jumpPrepareTime) { previousVerticalMotor.copyFrom(moveen.engine.verticalMotor); } if (grabInput) { if (Input.GetKey(KeyCode.Space)) { jumpStrengthCurTime = 0; jumpPreparing = true; } else { jumpPreparing = false; } Vector3 upDown = localWasd ? new Vector3(1, 0, 0) : new Vector3(0, 0, 1); Vector3 leftRight = localWasd ? new Vector3(0, 0, 1) : new Vector3(-1, 0, 0); if (Input.GetKey(KeyCode.W) || debugMoveForward) { add += upDown; movePressed = true; } if (Input.GetKey(KeyCode.S)) { add -= upDown; movePressed = true; } if (Input.GetKey(KeyCode.A)) { add += leftRight; movePressed = true; } if (Input.GetKey(KeyCode.D)) { add -= leftRight; movePressed = true; } add = add.normalized(); add *= maxSpeed / moveen.engine.horizontalMotor.distanceToSpeed; if (!localWasd) { add = bodyRigid.transform.rotation.conjug().rotate(add); //global -> body local } //limit forward, strafe, and rear speed if (add.x > 0) { add.x = Math.Min(add.x, maxSpeed); } if (add.x < 0) { add.x = Math.Max(add.x, -maxSpeed * rearSpeedMultiplyer); } if (add.z > 0) { add.z = Math.Min(add.z, maxSpeed * strafeSpeedMultiplyer); } if (add.z < 0) { add.z = Math.Max(add.z, -maxSpeed * strafeSpeedMultiplyer); } add = bodyRigid.transform.rotation.rotate(add); //body local -> global } Vector3 newBestTargetPos = moveen.engine.imCenter.add(add).withSetY(h); if (quantCenter) { if (dockedCount == 0 || movePressed || newBestTargetPos.dist(transform.position) > quantSize) { transform.position = newBestTargetPos; } } else { transform.position = newBestTargetPos; } wantedCamera = moveen.engine.imCenter.withSetY(h); RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); Quaternion wantedRot = transform.rotation; Vector3 hitPoint = new Vector3(); bool wasHit = false; if (grabInput) { wasHit = Physics.Raycast(ray.origin, ray.direction, out hit); //TODO cached hitPoint = hit.point; if (wasHit) { //lower target, because we are looking from the top, but the actor will be aiming from a side // but we don't want correct height for walls and terrain if (hit.normal.y > 0.5f && hit.point.y > hit.collider.transform.position.y) { hitPoint.y = hit.collider.transform.position.y; } //Debug.DrawLine(new Vector3(-100, -100, -100), hitPoint, Color.red); if (moveen.engine.imCenter.dist(hitPoint) > 1) { wantedRot = MUtil.qToAxes(hitPoint - moveen.engine.imCenter, Vector3.up); } } } oldCam = oldCam.mix(wantedCamera, camApproachFactor); if (grabInput) { cam.transform.position = cam.transform.position.mix(oldCam + camPosition + wantedRot.rotate(new Vector3(maxSpeed * camAheadMul, 0, 0)), 0.1f); cam.transform.eulerAngles = camRotation; } // cam.transform.position = oldCam + camPosition + wantedRot.rotate(new Vector3(maxSpeed, 0, 0)); if (dockedCount > 0) { //rotate target only if at least one leg is touching ground float cosOfHalfAngle = (float)Math.Cos(bodyRotReactionSpeed / 2 / 180f * Math.PI); //TODO cache Quaternion rotDif = wantedRot.rotSub(transform.rotation); if (rotDif.w < 0) { rotDif = rotDif.scale(-1); } if (rotDif.w < cosOfHalfAngle) { rotDif = rotDif.normalizeWithFixedW(cosOfHalfAngle); } transform.rotation = transform.rotation * rotDif; } else { //get rotation from the body when in air // because else - body could accumulate rotation it will be looking weird after grounding transform.rotation = moveen.targetRot; } moveen.targetPos = transform.position; moveen.targetRot = transform.rotation; //must be after this transform pos/rot change as target can be child of this if (wasHit && aimTarget != null) { aimTarget.position = hitPoint; } }
private void formingShape_Shown(object sender, EventArgs e) { Step2.Focus(); }
public Answer2(Step2 next, object finalAnswer) { this.Next = next; this.FinalAnswer = finalAnswer; }