public void State_lowerdown_Update() { float dt = FrameController.DT(); if (riseupTimer_ <= riseupTime_) { riseupTimer_ += dt; trans_.SetPositionY(MMath.Cerp(upperTrans_.position.y, lowerTrans_.position.y, riseupTimer_ / riseupTime_)); } if (startupTimer_ <= shutdownTime_) { startupTimer_ += dt; revTime_ = MMath.Lerp(revFinalTime_, 50, startupTimer_ / shutdownTime_); revInc_ = 360.0f / revTime_; } if (riseupTimer_ > riseupTime_ && startupTimer_ > shutdownTime_) { smc.SetState(end); } //else if(riseupTimer_ >= riseupTime_ + transitionTime_) // smc.SetState(riseup); trans_.RotateAround(0, 1, 0, revInc_ * dt); }
void State_Moving_Update() { timer += FrameController.DT(); if (moveTime == 0) { Logger.Log("Elevator moveTime is 0, cannot use script."); return; } if (timer / moveTime > 0.5f) { if (TeleportToHub) { GameObject marker = GameObject.GetGameObjectByName("hubelevatorteleportmarker"); float distx = marker.transform.position.x - gameObject.transform.position.x; float distz = marker.transform.position.z - gameObject.transform.position.z; player.transform.SetPositionX(player.transform.position.x + distx); player.transform.SetPositionZ(player.transform.position.z + distz); gameObject.transform.SetPosition(marker.transform.position); TeleportToHub = false; } } float y = MMath.Cerp(startY, endY, MMath.Clamp01(timer / moveTime)); gameObject.transform.SetPositionY(y); player.transform.SetPositionY(y + 0.2f); }
public void State_Moving_Update() { //Logger.Log(moving.GetPercentageTime().ToString()); timer += FrameController.DT(); gameObject.transform.SetPositionY(MMath.Cerp(startY, endY, MMath.Clamp01(timer / 1.2f))); }
public void OnUpdate() { timer += FrameController.DT(); float rgb = MMath.Cerp(0.0f, 1.0f, MMath.Clamp01(timer / 3.0f)); cr.GetMaterial().SetColor(new Color(rgb, rgb, rgb, 1.0f)); }
public static Vector3 CerpVector(Vector3 start, Vector3 end, float percent) { Vector3 result = new Vector3(); result.X = MMath.Cerp(start.X, end.X, percent); result.Y = MMath.Cerp(start.Y, end.Y, percent); result.Z = MMath.Cerp(start.Z, end.Z, percent); return(result); }
void State_returning_Update() { timer += FrameController.DT(); if (moveTime == 0) { Logger.Log("Elevator moveTime is 0, cannot use script."); return; } float y = MMath.Cerp(endY, startY, MMath.Clamp01(timer / moveTime)); gameObject.transform.SetPositionY(y); }
public void State_riseup_Update() { float dt = FrameController.DT(); riseupTimer_ += dt; if (riseupTimer_ <= riseupTime_) { trans_.SetPositionY(MMath.Cerp(lowerTrans_.position.y, upperTrans_.position.y, riseupTimer_ / riseupTime_)); } else if (riseupTimer_ >= riseupTime_ + transitionTime_) { smc.SetState(lowerdown); } trans_.RotateAround(0, 1, 0, revInc_ * dt); }
public void State_startup_Update() { float dt = FrameController.DT(); startupTimer_ += dt; if (startupTimer_ <= startupTime_) { revTime_ = MMath.Cerp(revInitTime_, revFinalTime_, startupTimer_ / startupTime_); revInc_ = 360.0f / revTime_; } else if (startupTimer_ >= startupTime_ + transitionTime_) { smc.SetState(riseup); } trans_.RotateAround(0, 1, 0, revInc_ * dt); }
public void S_Light_Update() { light.mIntensity = MMath.Cerp(mBeginInten, mTargetIntensity, smc.GetCurrentState().GetPercentageTime()); }
void S_bindsmoveup_Update() { binds.transform.SetPositionY(MMath.Cerp(player.transform.position.y, player.transform.position.y - BINDSOFFSET, bindsmovedown.GetPercentageTime())); }