private void OnPhysicsModeChanged(PhysicsMode physicsMode) { Reset(); uiController.OnPhysicsModeChanged(physicsMode); switch (physicsMode) { case PhysicsMode.Forces: ExecuteVectorLearningMode(); break; case PhysicsMode.Energy: ExecuteEnergyLearningMode(); break; case PhysicsMode.FreePlayTarget: ExecuteFreePlayTargetMode(); break; case PhysicsMode.FreePlayBox: ExecuteFreePlayBoxMode(); break; case PhysicsMode.BasketballChallenge: ExecuteBasketballMode(); break; } }
/// <summary> /// Ctor. /// </summary> /// <param name="GravityDirection">Unit vector for spatial direction of gravity.</param> /// <param name="SpatialComponent">Spatial component of source.</param> /// <param name="Froude">Dimensionless Froude number.</param> /// <param name="physicsMode"></param> /// <param name="EoS">Equation of state for calculating density.</param> public Buoyancy(Vector GravityDirection, int SpatialComponent, double Froude, PhysicsMode physicsMode, MaterialLaw EoS) { // Check direction if ((GravityDirection.Abs() - 1.0) > 1.0e-13) { throw new ArgumentException("Length of GravityDirection vector has to be 1.0"); } // Initialize this.GravityDirection = GravityDirection; this.SpatialComponent = SpatialComponent; this.Froude = Froude; this.EoS = EoS; this.physicsMode = physicsMode; switch (physicsMode) { case PhysicsMode.LowMach: this.m_ParameterOrdering = new string[] { VariableNames.Temperature0 }; break; case PhysicsMode.Combustion: this.m_ParameterOrdering = new string[] { VariableNames.Temperature0, VariableNames.MassFraction0_0, VariableNames.MassFraction1_0, VariableNames.MassFraction2_0, VariableNames.MassFraction3_0 }; break; default: throw new ApplicationException("wrong physicsmode"); } }
/// <summary> /// Ctor. /// <param name="HeatRelease">Heat release computed from the sum of the product of the stoichiometric coefficient, partial heat capacity and molar mass of species alpha for all species. I.e.: sum(alpha = 1.. ns)[v_\alpha cp_alpha M_alpha]. Must be computed locally for non-constant partial heat capacities in later iterations of the code.</param> /// <param name="Reynolds">The Reynolds number</param> /// <param name="Prandtl">The Prandtl number</param> /// <param name="Schmidt">The Schmidt number</param> /// <param name="StoichiometricCoefficients">0. of fuel, 1. of oxidizer, 2. of CO2, 3. of H2O</param> /// <param name="ReactionRateConstants">0. PreExpFactor/Damköhler number, 1. ActivationTemperature, 2. MassFraction0Exponent, 3. MassFraction1Exponent</param> /// <param name="MolarMasses">Array of molar masses of fuel, oxidizer, CO2 and H2O</param> /// <param name="EoS">Material law</param> /// <param name="EqType">Temperature" for temperature equation. "MassFraction" for a MassFraction balance</param> /// <param name="physicsMode"></param> /// <param name="phystime"></param> /// <param name="unsteady"></param> /// <param name="SpeciesIndex">(optional). Necessary for "MassFraction" EqType. Species index: 0 for fuel, 1 for oxidizer, 2 for CO2 and 3 for H2O.</param> /// <param name="chemReactionOK"></param> /// <param name="rhoOne"></param> /// </summary> public RHSManuSourceTransportEq(double HeatRelease, double Reynolds, double Prandtl, double Schmidt, double[] StoichiometricCoefficients, double[] ReactionRateConstants, double[] MolarMasses, MaterialLaw EoS, String EqType, PhysicsMode physicsMode, int SpeciesIndex = -1, bool chemReactionOK = true, bool rhoOne = false, Func <double[], double, double> _sourceFunc = null) { this.HeatRelease = HeatRelease; this.ReynoldsNumber = Reynolds; this.PrandtlNumber = Prandtl; this.SchmidtNumber = Schmidt; this.Eos = EoS; this.EqType = EqType; this.physicsMode = physicsMode; this.chemReactionOK = chemReactionOK; this.rhoOne = rhoOne; if (EqType == "MassFraction") { this.SpeciesIndex = SpeciesIndex; this.StoichiometricCoeff = StoichiometricCoefficients[SpeciesIndex]; } this.Da = ReactionRateConstants[0]; // Damköhler number this.Ta = ReactionRateConstants[1]; this.a = ReactionRateConstants[2]; this.b = ReactionRateConstants[3]; this.MolarMasses = MolarMasses; this.sourceFunc = _sourceFunc; }
/// <summary> /// Ctor. /// <param name="HeatReleaseFactor">Heat release computed from the sum of the product of the stoichiometric coefficient, partial heat capacity and molar mass of species alpha for all species. I.e.: sum(alpha = 1.. ns)[v_\alpha cp_alpha M_alpha]. Must be computed locally for non-constant partial heat capacities in later iterations of the code.</param> /// <param name="Reynolds">The Reynolds number</param> /// <param name="Prandtl">The Prandtl number</param> /// <param name="Schmidt">The Schmidt number</param> /// <param name="StoichiometricCoefficients">0. of fuel, 1. of oxidizer, 2. of CO2, 3. of H2O</param> /// <param name="ReactionRateConstants">0. PreExpFactor/Damköhler number, 1. ActivationTemperature, 2. MassFraction0Exponent, 3. MassFraction1Exponent</param> /// <param name="MolarMasses">Array of molar masses of fuel, oxidizer, CO2 and H2O</param> /// <param name="OneOverMolarMass0MolarMass1"> 1/(M_infty^(a + b -1) * MolarMassFuel^a * MolarMassOxidizer^b). M_infty is the reference for the molar mass steming from non-dimensionalisation of the governing equations.</param> /// <param name="EoS">Material law</param> /// <param name="EqType">Temperature" for temperature equation. "MassFraction" for a MassFraction balance</param> /// <param name="physicsMode"></param> /// <param name="phystime"></param> /// <param name="unsteady"></param> /// <param name="SpeciesIndex">(optional). Necessary for "MassFraction" EqType. Species index: 0 for fuel, 1 for oxidizer, 2 for CO2 and 3 for H2O.</param> /// </summary> public RHSManuSourceTransportEq(double HeatReleaseFactor, double Reynolds, double Prandtl, double Schmidt, double[] StoichiometricCoefficients, double[] ReactionRateConstants, double[] MolarMasses, double OneOverMolarMass0MolarMass1, MaterialLaw EoS, String EqType, PhysicsMode physicsMode, double phystime, bool unsteady, SinglePhaseField ThermodynamicPressure, int SpeciesIndex = -1) { this.HeatReleaseFactor = HeatReleaseFactor; this.ReynoldsNumber = Reynolds; this.PrandtlNumber = Prandtl; this.SchmidtNumber = Schmidt; this.Eos = EoS; this.EqType = EqType; this.physicsMode = physicsMode; this.phystime = phystime; this.unsteady = unsteady; if (EqType == "MassFraction") { this.SpeciesIndex = SpeciesIndex; this.StoichiometricCoeff = StoichiometricCoefficients[SpeciesIndex]; } this.PreExpFactor = ReactionRateConstants[0]; this.ActivationTemperature = ReactionRateConstants[1]; this.MassFraction0Exponent = ReactionRateConstants[2]; this.MassFraction1Exponent = ReactionRateConstants[3]; this.MolarMasses = MolarMasses; this.OneOverMolarMass0MolarMass1 = OneOverMolarMass0MolarMass1; this.ThermodynamicPressure = ThermodynamicPressure; }
void OnCollisionEnter2D(Collision2D other) { if (rb.velocity.magnitude > 5) { bigSplat.Play(); } else if (rb.velocity.magnitude > 2) { smallSplat.Play(); source.volume = VolumeManager.dialogueVolume; source.PlayOneShot(ouchSounds[Random.Range(0, ouchSounds.Length)]); } if (rb.velocity.magnitude > 3) { source.volume = VolumeManager.dialogueVolume; source.PlayOneShot(ouchSounds[Random.Range(0, ouchSounds.Length)]); } if (other.transform.tag == "Jack" && physicsMode == PhysicsMode.normal) { anim.SetBool("puff", true); physicsMode = PhysicsMode.puffed; rb.AddForce((transform.position - other.transform.position) * 5f); } }
/// <summary> /// Ctor for variable density flows /// </summary> /// <param name="EoS">The material law</param> /// <param name="energy">Set conti: true for the energy equation</param> /// <param name="ArgumentOrdering"></param> /// <param name="TimeStepSize"></param> public MassMatrixComponent(MaterialLaw EoS, String[] ArgumentOrdering, int j, PhysicsMode _physicsMode, int spatDim, int NumberOfReactants) { this.j = j; this.EoS = EoS; m_ParameterOrdering = EoS.ParameterOrdering; this.m_SpatialDimension = spatDim; this.NumberOfReactants = NumberOfReactants; int SpatDim = 2; int numberOfReactants = 3; this.physicsMode = _physicsMode; switch (_physicsMode) { case PhysicsMode.Multiphase: m_ArgumentOrdering = new string[] { VariableNames.LevelSet }; m_ParameterOrdering = ArrayTools.Cat(VariableNames.Velocity0Vector(SpatDim), VariableNames.Velocity0MeanVector(SpatDim)); break; case PhysicsMode.LowMach: m_ArgumentOrdering = ArrayTools.Cat(VariableNames.VelocityVector(SpatDim), VariableNames.Temperature); if (EoS == null) { throw new ApplicationException("EoS has to be given for Low-Mach flows to calculate density."); } else { this.EoS = EoS; } break; case PhysicsMode.MixtureFraction: m_ArgumentOrdering = ArrayTools.Cat(VariableNames.VelocityVector(SpatDim), VariableNames.MixtureFraction); if (EoS == null) { throw new ApplicationException("EoS has to be given for Low-Mach flows to calculate density."); } else { this.EoS = EoS; } break; case PhysicsMode.Combustion: m_ArgumentOrdering = ArrayTools.Cat(VariableNames.VelocityVector(SpatDim), VariableNames.Temperature, VariableNames.MassFractions(numberOfReactants - 1)); // u,v,w,T, Y0,Y1,Y2,Y3 as variables (Y4 is calculated as Y4 = 1- (Y0+Y1+Y2+Y3) if (EoS == null) { throw new ApplicationException("EoS has to be given for Low-Mach flows to calculate density."); } else { this.EoS = EoS; } break; default: throw new NotImplementedException(); } }
void OnTriggerExit2D(Collider2D other) { if (other.tag == "Water") { physicsMode = PhysicsMode.normal; } }
/// <summary> /// Ctor. /// </summary> public RHSManuSourceDivKonti(double Reynolds, double[] MolarMasses, PhysicsMode physicsMode, double phystime, bool unsteady) { this.ReynoldsNumber = Reynolds; this.MolarMasses = MolarMasses; this.physicsMode = physicsMode; this.phystime = phystime; this.unsteady = unsteady; }
/// <summary> /// Ctor. /// </summary> public RHSManuSourceDivKonti(double Reynolds, double[] MolarMasses, PhysicsMode physicsMode, bool rhoOne, Func <double[], double, double> _sourceFunc = null) { this.ReynoldsNumber = Reynolds; this.MolarMasses = MolarMasses; this.physicsMode = physicsMode; this.rhoOne = rhoOne; this.sourceFunc = _sourceFunc; }
/// <summary> /// Ctor. /// </summary> public RHSManuSourceDivKonti(double Reynolds, double[] MolarMasses, PhysicsMode physicsMode, double phystime, bool unsteady, SinglePhaseField ThermodynamicPressure) { this.ReynoldsNumber = Reynolds; this.MolarMasses = MolarMasses; this.physicsMode = physicsMode; this.phystime = phystime; this.unsteady = unsteady; this.ThermodynamicPressure = ThermodynamicPressure; }
private void OnEditorPhysicsModeChanged(PhysicsMode _physicsMode) { physicsMode = _physicsMode; if (GameManager.GetInstance() != null) { StartLesson(); } }
// Use this for initialization void Start() { physicsMode = PhysicsMode.frozen; rb = GetComponent <Rigidbody2D>(); startPos = transform.position; pufferMaterial.color = startColor; source.volume = VolumeManager.dialogueVolume; source.PlayOneShot(startSounds[Random.Range(0, startSounds.Length)]); }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Water") { physicsMode = PhysicsMode.water; Destroy(Instantiate(Resources.Load("Splash"), transform.position, Quaternion.Euler(-90, 0, 0)), 4); source.volume = VolumeManager.sfxVolume; source.PlayOneShot(Resources.Load <AudioClip>("Audio/splash_calm")); } }
/// <summary> /// <param name="Reynolds"></param> /// <param name="Froude"></param> /// Ctor. /// <param name="MolarMasses">Array of the molar masses of the fuel, oxidizer and products.</param> /// <param name="direction">Can be "x" or "y".</param> /// <param name="physMode"></param> /// </summary> public RHSManuSourceNS(double Reynolds, double Froude, double[] MolarMasses, string direction, PhysicsMode physMode, bool rhoOne, Func <double[], double, double> _SourceTerm) { this.MolarMasses = MolarMasses; this.direction = direction; this.Reynolds = Reynolds; this.physMode = physMode; this.Froude = Froude; this.rhoOne = rhoOne; this.SourceTerm = _SourceTerm; }
/// <summary> /// <param name="Reynolds"></param> /// <param name="Froude"></param> /// Ctor. /// <param name="MolarMasses">Array of the molar masses of the fuel, oxidizer and products.</param> /// <param name="direction">Can be "x" or "y".</param> /// <param name="physMode"></param> /// </summary> public RHSManuSourceNS(double Reynolds, double Froude, double[] MolarMasses, string direction, PhysicsMode physMode, double phystime, bool unsteady) { this.MolarMasses = MolarMasses; this.direction = direction; this.Reynolds = Reynolds; this.physMode = physMode; this.Froude = Froude; this.unsteady = unsteady; this.phystime = phystime; }
public void Begin() { if (physicsMode != PhysicsMode.frozen) { End(); } else { physicsMode = PhysicsMode.normal; transform.rotation = Quaternion.Euler(0, 0, 0); } }
/// <summary> /// <param name="Reynolds"></param> /// <param name="Froude"></param> /// Ctor. /// <param name="MolarMasses">Array of the molar masses of the fuel, oxidizer and products.</param> /// <param name="direction">Can be "x" or "y".</param> /// <param name="physMode"></param> /// </summary> public RHSManuSourceNS(double Reynolds, double Froude, double[] MolarMasses, string direction, PhysicsMode physMode, double phystime, bool unsteady, SinglePhaseField ThermodynamicPressure) { this.MolarMasses = MolarMasses; this.direction = direction; this.Reynolds = Reynolds; this.physMode = physMode; this.Froude = Froude; this.unsteady = unsteady; this.phystime = phystime; this.ThermodynamicPressure = ThermodynamicPressure; }
private void StartBasketballChallenge() { LearningStep = 0; if (GameManager.GetInstance() != null) { GameManager.GetInstance().lessonStarted = true; GameManager.GetInstance().CurrentPhysicsMode = PhysicsMode = PhysicsMode.BasketballChallenge; } else { Debug.Log("Click [Start Playing] Button on the Physics Config Panel to Start the lesson"); } }
/// <summary> /// Ctor for common part of incompressible and low Mach number flows. /// </summary> /// <param name="SpatDim"></param> /// <param name="_bcmap"></param> /// <param name="_component"></param> private LinearizedConvection(int SpatDim, IncompressibleBoundaryCondMap _bcmap, int _component) { m_SpatialDimension = SpatDim; m_bcmap = _bcmap; m_component = _component; velFunction = new Func <double[], double, double> [GridCommons.FIRST_PERIODIC_BC_TAG, SpatDim]; for (int d = 0; d < SpatDim; d++) { velFunction.SetColumn(m_bcmap.bndFunction[VariableNames.Velocity_d(d)], d); } PhysMode = _bcmap.PhysMode; }
/// <summary> /// バイナリデータから読み込み /// </summary> /// <param name="reader">読み込むファイル</param> public void Read(BinaryReader reader) { IsShowInfomation = reader.ReadBoolean(); IsShowAxis = reader.ReadBoolean(); IsShowGrandShadow = reader.ReadBoolean(); FPSLimit = reader.ReadSingle(); ScreenCaptureSetting = (ScreenCaptureMode)reader.ReadInt32(); AccessoryModelThreshold = reader.ReadInt32(); GroundShadowBrightness = reader.ReadSingle(); EnableTransparentGroundShadow = reader.ReadBoolean(); PhysicsSetting = (PhysicsMode)reader.ReadByte(); }
static string[] BndFunctions(IGridData g, PhysicsMode _PhysicsMode) { int D = g.SpatialDimension; string[] ScalarFields; switch (_PhysicsMode) { case PhysicsMode.Incompressible: ScalarFields = new string[] { VariableNames.Pressure }; break; case PhysicsMode.LowMach: ScalarFields = new string[] { VariableNames.Pressure, VariableNames.Temperature }; break; case PhysicsMode.Multiphase: ScalarFields = new string[] { VariableNames.Pressure, VariableNames.LevelSet }; break; case PhysicsMode.Combustion: ScalarFields = new string[] { VariableNames.Pressure, VariableNames.Temperature, VariableNames.MassFraction0, VariableNames.MassFraction1, VariableNames.MassFraction2, VariableNames.MassFraction3, VariableNames.MassFraction4 }; break; case PhysicsMode.Helical: ScalarFields = new string[] { VariableNames.u, VariableNames.v, VariableNames.w, VariableNames.Pressure }; return(ScalarFields); case PhysicsMode.Viscoelastic: ScalarFields = new string[] { VariableNames.Pressure, VariableNames.StressXX, VariableNames.StressXY, VariableNames.StressYY }; break; case PhysicsMode.RANS: ScalarFields = new string[] { VariableNames.Pressure, "k", "omega" }; // TODO physics mode for each turbulence model? break; case PhysicsMode.MixtureFraction: ScalarFields = new string[] { VariableNames.Pressure, VariableNames.MixtureFraction }; break; default: throw new ArgumentException(); } return(ArrayTools.Cat(VariableNames.VelocityVector(D), ScalarFields)); }
public PhysicalProcessor(Scene scene, Vector2f gravity, uint iterationsCount, PhysicsMode mode) { IterCount = iterationsCount; StaticResistance = 0.3; var sceneSize = scene.Size; Gravity = gravity; this.mode = mode; master = scene; var colonsCount = (int)(sceneSize.X / CollisionCell.Size) + 1; var rowsCount = (int)(sceneSize.Y / CollisionCell.Size) + 1; cellMap = new CollisionCell[colonsCount, rowsCount]; for (var x = 0; x < cellMap.GetLength(0); x++) for (var y = 0; y < cellMap.GetLength(1); y++) cellMap[x, y] = new CollisionCell(); }
public void OnPhysicsModeChanged(PhysicsMode physicsMode) { Reset(); HideFreeplayUIPanels(); switch (physicsMode) { case PhysicsMode.FreePlayTarget: targetUI.gameObject.SetActive(true); break; case PhysicsMode.FreePlayBox: boxesUI.gameObject.SetActive(true); break; case PhysicsMode.BasketballChallenge: ballUIPanel.gameObject.SetActive(true); break; } }
public PhysicalProcessor(Scene scene, Vector2f gravity, uint iterationsCount, PhysicsMode mode) { IterCount = iterationsCount; StaticResistance = 0.3; var sceneSize = scene.Size; Gravity = gravity; this.mode = mode; master = scene; var colonsCount = (int)(sceneSize.X / CollisionCell.Size) + 1; var rowsCount = (int)(sceneSize.Y / CollisionCell.Size) + 1; cellMap = new CollisionCell[colonsCount, rowsCount]; for (var x = 0; x < cellMap.GetLength(0); x++) { for (var y = 0; y < cellMap.GetLength(1); y++) { cellMap[x, y] = new CollisionCell(); } } }
/// <summary> /// Ctor. /// </summary> /// <param name="GravityDirection">Unit vector for spatial direction of gravity.</param> /// <param name="SpatialComponent">Spatial component of source.</param> /// <param name="Froude">Dimensionless Froude number.</param> /// <param name="physicsMode"></param> /// <param name="EoS">Equation of state for calculating density.</param> public Buoyancy(double[] GravityDirection, int SpatialComponent, double Froude, PhysicsMode physicsMode, MaterialLaw EoS) { // Check direction double sum = 0.0; for (int i = 0; i < GravityDirection.Length; i++) { sum += GravityDirection[i] * GravityDirection[i]; } double DirectionNorm = Math.Sqrt(sum); if ((DirectionNorm - 1.0) > 1.0e-13) { throw new ArgumentException("Length of GravityDirection vector has to be 1.0"); } // Initialize this.GravityDirection = GravityDirection; this.SpatialComponent = SpatialComponent; this.Froude = Froude; this.EoS = EoS; this.physicsMode = physicsMode; switch (physicsMode) { case PhysicsMode.LowMach: this.m_ParameterOrdering = new string[] { VariableNames.Temperature0 }; break; case PhysicsMode.Combustion: this.m_ParameterOrdering = new string[] { VariableNames.Temperature0, VariableNames.MassFraction0_0, VariableNames.MassFraction1_0, VariableNames.MassFraction2_0, VariableNames.MassFraction3_0 }; break; default: throw new ApplicationException("wrong physicsmode"); } }
// Update is called once per frame void Update() { if (timeElapsed <= 0 && timeResetting) { timeResetting = false; timeScale = 1; } if (timeElapsed <= antimatterResetTime) { antimatterResetTime = -1; } GetMovementInput(); GetTimeManipInput(); GetVisualModeInput(); if (!LevelManager.instance.inBounds(transform.position)) { transform.position = LevelManager.instance.reflect(transform.position); } if (!loadNextLevel && GetComponent <Camera>().fieldOfView <= 90 && (Input.GetKeyDown(KeyCode.P) || Input.GetKeyDown(KeyCode.Escape))) { gamePaused = !gamePaused; pauseMenu.GetComponent <Animator>().SetBool("GamePaused", gamePaused); if (gamePaused) { pauseMenu.GetComponent <CanvasGroup>().interactable = true; pauseMenu.transform.FindChild("PauseTitle").GetComponent <LevelIntroText>().Start(); timeReversed = false; timeFrozen = true; Cursor.visible = true; Cursor.lockState = CursorLockMode.None; } else { pauseMenu.GetComponent <CanvasGroup>().interactable = false; timeReversed = false; timeFrozen = false; Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; } } //time manipulation code if (timeFrozen) { if (timeScale < 0) { timeScale = Mathf.MoveTowards(timeScale, 0, Time.deltaTime * 3f * Mathf.Abs(REVERSE_TIME_SCALE)); } else { timeScale = Mathf.MoveTowards(timeScale, 0, Time.deltaTime * 3f); } GetComponent <MotionBlur>().blurAmount = Mathf.MoveTowards(GetComponent <MotionBlur>().blurAmount, 0.5f, Time.deltaTime * 3f); } else { if (timeReversed) { entangleSelected = null; if (timeElapsed <= 0) { timeReversed = false; timeResetting = false; timeElapsed = 0; noStateChangesThisFrame = true; } else { timeScale = Mathf.MoveTowards(timeScale, REVERSE_TIME_SCALE, Time.deltaTime * 3f * Math.Abs(REVERSE_TIME_SCALE)); GetComponent <VignetteAndChromaticAberration>().chromaticAberration = Mathf.MoveTowards(GetComponent <VignetteAndChromaticAberration>().chromaticAberration, -timeScale * 30f, Time.deltaTime * 10f * Math.Abs(REVERSE_TIME_SCALE)); } } else if (timeResetting) { timeScale = -100; } else { GetComponent <VignetteAndChromaticAberration>().chromaticAberration = Mathf.MoveTowards(GetComponent <VignetteAndChromaticAberration>().chromaticAberration, 0f, Time.deltaTime * 200f); if (timeScale < 0) { timeScale = Mathf.MoveTowards(timeScale, 0, Time.deltaTime * 3f * Math.Abs(REVERSE_TIME_SCALE)); } else { timeScale = Mathf.MoveTowards(timeScale, 1, Time.deltaTime * 3f); } } if (!noStateChangesThisFrame || timeReversed || timeResetting) { timeElapsed = Mathf.Max(0, timeElapsed + timeScale); noStateChangesThisFrame = true; } GetComponent <MotionBlur>().blurAmount = Mathf.MoveTowards(GetComponent <MotionBlur>().blurAmount, 0f, Time.deltaTime * 3f); } //First person controls float rotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivityX; float rotationY = transform.localEulerAngles.x - Input.GetAxis("Mouse Y") * sensitivityY; if (Camera.main.fieldOfView <= 90f && !gamePaused) { transform.localEulerAngles = new Vector3(rotationY, rotationX, 0); transform.Translate(velocityVector * Time.deltaTime, Space.World); velocityVector = Vector3.MoveTowards(velocityVector, Vector3.zero, Time.deltaTime * 2f); } //switching skills if (!gamePaused) { if (Input.GetKeyDown(KeyCode.Alpha1)) { currentMode = PhysicsMode.Mass; } else if (Input.GetKeyDown(KeyCode.Alpha2)) { currentMode = PhysicsMode.Charge; } else if (Input.GetKeyDown(KeyCode.Alpha3)) { currentMode = PhysicsMode.Entangle; } } RaycastHit rh = new RaycastHit(); float clipPlane = Camera.main.nearClipPlane; Camera.main.nearClipPlane = 0.1f; Ray cameraRay = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f)); Camera.main.nearClipPlane = clipPlane; Debug.DrawRay(transform.position, cameraRay.direction * 10f); if (!gamePaused && Physics.Raycast(cameraRay.origin, cameraRay.direction, out rh, 100000, ~(1 << 10))) { GetComponent <DepthOfField>().focalLength = Vector3.Distance(transform.position, rh.point); // GetComponent<DepthOfField>().aperture = Mathf.MoveTowards(GetComponent<DepthOfField>().aperture, 10/(Vector3.Distance(transform.position, rh.point)), Time.deltaTime*10f); if (rh.transform.gameObject.GetComponent <PhysicsModifyable>() != null) { lookingAtObject = rh.transform.gameObject; if (!wireframeMode) { lookingAtObject.GetComponent <AutoWireframeWorld>().HighlightObject(); } PhysicsModifyable pM = rh.transform.gameObject.GetComponent <PhysicsModifyable>(); rh.transform.gameObject.GetComponent <Renderer>().material.SetFloat("_Power", 0.3f); float delta = 10 * Input.mouseScrollDelta.y * Time.deltaTime; if (delta == 0) { delta = (Input.GetKeyDown(KeyCode.UpArrow) ? 0.5f : 0) + -1 * (Input.GetKeyDown(KeyCode.DownArrow) ? 0.5f : 0); } if (!timeReversed && !timeResetting && !pM.immutable) { //Increases/Decreases mass of object if (!pM.specificallyImmutable.mass && currentMode == PhysicsMode.Mass) { float tempVal = pM.Mass; pM.Mass = Mathf.Min(6, Mathf.Max(0, pM.Mass + delta)); if (pM.Mass != tempVal) { physicsSFXManager.GetComponent <PhysicsSFXManager>().PlayGravityChangeSFX(delta); } } // Increase/Decrease charge of object else if (!pM.specificallyImmutable.charge && currentMode == PhysicsMode.Charge) { if ((pM.Charge == -1 && delta > 0) || (pM.Charge == 1 && delta < 0)) { pM.Charge = 0; } else if (delta != 0) { pM.Charge = Mathf.Sign(delta); } } // Quantum Entangle objects else // if(!pM.specificallyImmutable.entangled && currentMode == PhysicsMode.Entangle) { { if (Input.GetMouseButtonDown(0)) { if (pM.entangled != null) { //Debug.Log("Detangle"); pM.entangled.Entangled = null; pM.Entangled = null; entangleSelected = null; if (entangleLine != null) { Destroy(entangleLine.gameObject); } } else if (entangleSelected != null && entangleSelected != pM) { //Debug.Log("Entangle " + pM + ":" + entangleSelected); pM.Entangled = entangleSelected; entangleSelected.Entangled = pM; entangleSelected = null; if (entangleLine != null) { Destroy(entangleLine.gameObject); } } else if (!pM.specificallyImmutable.entangled) { //Debug.Log("Entangle " + pM); entangleSelected = pM; if (entangleLine == null) { entangleLine = new GameObject("EntangleLine", typeof(LineRenderer)); entangleLine.GetComponent <LineRenderer>().useWorldSpace = true; entangleLine.GetComponent <LineRenderer>().sharedMaterial = Resources.Load <GameObject>("SwitchLine").GetComponent <LineRenderer>().sharedMaterial; entangleLine.GetComponent <LineRenderer>().material.color = Color.black; entangleLine.GetComponent <LineRenderer>().SetPosition(0, pM.transform.position); } } } } if (currentMode == PhysicsMode.Mass || currentMode == PhysicsMode.Charge) { entangleSelected = null; } } } else { lookingAtObject = null; } } else if (Input.GetMouseButtonDown(0)) { // handles canceling entanglement entangleSelected = null; if (entangleLine != null) { Destroy(entangleLine.gameObject); } } else { lookingAtObject = null; } //Handles entangle indicator if (entangleLine != null) { LineRenderer entangleRenderer = entangleLine.GetComponent <LineRenderer>(); if (entangleSelected != null) { entangleRenderer.SetWidth(Vector3.Distance(transform.position, entangleSelected.transform.position) / 30f, Vector3.Distance(transform.position, entangleSelected.transform.position) / 30f); if (lookingAtObject == null) { entangleRenderer.SetPosition(1, transform.position + (transform.forward * Vector3.Distance(transform.position, entangleSelected.transform.position))); } else if (lookingAtObject != null && lookingAtObject.GetComponent <PhysicsModifyable>() != null) { entangleRenderer.SetPosition(1, lookingAtObject.transform.position); } } } //Loading next level with cool transition if (loadNextLevel && !loadMainMenu) { loadNextLevelTimer += Time.deltaTime; if (loadNextLevelTimer > 2f) { if (loadingNextLevel == null) { loadingNextLevel = Application.LoadLevelAsync(Application.loadedLevel + 1); if (loadingNextLevel == null) { loadingNextLevel = Application.LoadLevelAsync(0); } loadingNextLevel.allowSceneActivation = false; physicsSFXManager.GetComponent <PhysicsSFXManager>().PlayWarpingSFX(); } starField.GetComponent <ParticleSystemRenderer>().lengthScale = Mathf.MoveTowards(starField.GetComponent <ParticleSystemRenderer>().lengthScale, 100, Time.deltaTime * 50f); Camera.main.fieldOfView = Mathf.MoveTowards(Camera.main.fieldOfView, 179f, Time.deltaTime * 30f); transform.Translate(transform.forward * Time.deltaTime * Camera.main.fieldOfView / 2f, Space.World); if (physicsSFXManager.GetComponent <AudioSource>().time / physicsSFXManager.GetComponent <AudioSource>().clip.length > 0.98f) { loadingNextLevel.allowSceneActivation = true; } } } else if (!loadNextLevel && !loadMainMenu) { starField.GetComponent <ParticleSystemRenderer>().lengthScale = Mathf.MoveTowards(starField.GetComponent <ParticleSystemRenderer>().lengthScale, 1, Time.deltaTime * 50f); Camera.main.fieldOfView = Mathf.MoveTowards(Camera.main.fieldOfView, 90f, Time.deltaTime * Camera.main.fieldOfView / 3f); if (Camera.main.fieldOfView > 90f) { transform.Translate(transform.forward * Time.deltaTime * 10f, Space.World); } } else if (loadNextLevel && loadMainMenu) { lookingAtObject = null; loadNextLevelTimer += Time.deltaTime; if (loadNextLevelTimer > 0.2f) { if (loadingNextLevel == null) { StartCoroutine(LoadMainMenuSeamlessly()); loadingNextLevel.allowSceneActivation = false; physicsSFXManager.GetComponent <PhysicsSFXManager>().PlayWarpingSFX(); } starField.GetComponent <ParticleSystemRenderer>().lengthScale = Mathf.MoveTowards(starField.GetComponent <ParticleSystemRenderer>().lengthScale, 100, Time.deltaTime * 50f); starField.transform.localPosition = new Vector3(0f, 0f, -300f); Camera.main.fieldOfView = Mathf.MoveTowards(Camera.main.fieldOfView, 179f, Time.deltaTime * 30f); transform.Translate(-transform.forward * Time.deltaTime * Camera.main.fieldOfView / 2f, Space.World); if (physicsSFXManager.GetComponent <AudioSource>().time / physicsSFXManager.GetComponent <AudioSource>().clip.length > 0.98f) { Cursor.visible = true; Cursor.lockState = CursorLockMode.None; loadingNextLevel.allowSceneActivation = true; } } } }
private void DrawEffectMenu(bool newSelection) { if (newSelection) { Tools.current = Tool.None; } GUIutilities.WriteTitle("Physic Effects Mode"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); physicModeCheck[0] = EditorGUILayout.ToggleLeft("All Rigidbodies", physicModeCheck[0], GUILayout.Width(150)); if (rootContainer == null) { physicModeCheck[0] = true; GUI.enabled = false; } else { GUI.enabled = true; } physicModeCheck[1] = EditorGUILayout.ToggleLeft("Only in Root Container", physicModeCheck[1]); GUI.enabled = true; EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); GUIutilities.WriteTitle("Physic Effect (SPACEBAR to activate)"); for (int i = 0; i < oldPhysicModeCheck.Length; i++) { if (oldPhysicModeCheck[i] != physicModeCheck[i]) { if (physicModeCheck[i] == true) { for (int j = 0; j < oldPhysicModeCheck.Length; j++) { if (j == i) { continue; } physicModeCheck[j] = false; } break; } else { physicModeCheck[i] = true; } } } for (int i = 0; i < oldPhysicModeCheck.Length; i++) { oldPhysicModeCheck[i] = physicModeCheck[i]; if (physicModeCheck[i]) { physicsMode = (PhysicsMode)i; } } physicsEffects = (PhysicsEffects)GUILayout.SelectionGrid((int)physicsEffects, convertEnumToStringArray(), convertEnumToStringArray().Length); if (physicsEffects == PhysicsEffects.Explosion) { EditorGUILayout.Space(); GUIutilities.SliderMinMax("Vertical Offset", ref ExplosionParams.minVerticalOffset, ref ExplosionParams.maxVerticalOffset, ref ExplosionParams.verticalOffset, 100); GUIutilities.SliderMinMax("Radius", ref ExplosionParams.minRadius, ref ExplosionParams.maxRadius, ref ExplosionParams.radius, 100); GUIutilities.SliderMinMax("Power", ref ExplosionParams.minPower, ref ExplosionParams.maxPower, ref ExplosionParams.power, 100); } if (physicsEffects == PhysicsEffects.SimpleForce) { EditorGUILayout.Space(); GUIutilities.SliderMinMax("Vertical Offset", ref SimpleForceParams.minVerticalOffset, ref SimpleForceParams.maxVerticalOffset, ref SimpleForceParams.verticalOffset, 100); GUIutilities.SliderMinMax("Radius", ref SimpleForceParams.minRadius, ref SimpleForceParams.maxRadius, ref SimpleForceParams.radius, 100); GUIutilities.simpleSlider("powerX", ref SimpleForceParams.powerX, -100, 100, 100); GUIutilities.simpleSlider("powerY", ref SimpleForceParams.powerY, 0, 100, 100); GUIutilities.simpleSlider("powerZ", ref SimpleForceParams.powerZ, -100, 100, 100); } if (physicsEffects == PhysicsEffects.BlackHole) { EditorGUILayout.Space(); GUIutilities.SliderMinMax("Vertical Offset", ref BlackHoleParams.minVerticalOffset, ref BlackHoleParams.maxVerticalOffset, ref BlackHoleParams.verticalOffset, 100); GUIutilities.SliderMinMax("Radius", ref BlackHoleParams.minRadius, ref BlackHoleParams.maxRadius, ref BlackHoleParams.radius, 100); GUIutilities.SliderMinMax("Power", ref BlackHoleParams.minPower, ref BlackHoleParams.maxPower, ref BlackHoleParams.power, 100); GUIutilities.SliderMinMax(new GUIContent("Modifier", "Modifies the internal equation for the black hole. A value between 1 and 2 appears to create a blob; a value from 0 to 1 creates an oscillating system. Not all values have been tested. Use at your own risk!!"), ref BlackHoleParams.minModifier, ref BlackHoleParams.maxModifier, ref BlackHoleParams.modifier, 100); } }
private void OnGUI() { #if UNITY_EDITOR Rect enumPopRect = new Rect(5, vertStart, 270, 30); GUILayoutOption[] enumPopLayout = { GUILayout.Width(100), GUILayout.Height(30) }; PhysicsMode = (PhysicsMode)EditorGUI.EnumPopup(enumPopRect, "Physics Lesson", PhysicsMode); if (GUI.Button(new Rect(10, 10, 80, 50), "Lesson 1\n[Forces]")) { StartForcesLesson(); } if (GUI.Button(new Rect(110, 10, 80, 50), "Lesson 2\n[Energy]")) { StartEnergyLesson(); } if (GUI.Button(new Rect(10, 70, 80, 50), "Free Play\n[Target]")) { StartFreePlayTarget(); } if (GUI.Button(new Rect(110, 70, 80, 50), "Free Play\n[Boxes]")) { StartFreePlayBox(); } if (GUI.Button(new Rect(210, 70, 80, 50), "Basketball\n[Challenge]")) { StartBasketballChallenge(); } if (EditorApplication.isPlaying && GameManager.HasInstance()) { GameManager gm = GameManager.GetInstance(); GUILayout.Space(vertStart + 40f); GUI.enabled = !gm.sliderLockOut && gm.CanProcessNextStep; GUILayoutOption[] massSliderLayout = { GUILayout.Width(350), GUILayout.Height(18) }; CannonBallMass = EditorGUILayout.Slider("Cannonball Mass", CannonBallMass, 1f, 20, massSliderLayout); GUILayoutOption[] springSliderLayout = { GUILayout.Width(350), GUILayout.Height(18) }; SpringK = EditorGUILayout.Slider("Spring Force", SpringK, 250, 15000, springSliderLayout); GUI.enabled = IsFreePlay() || GameManager.GetInstance().CanProcessNextStep; if (GUI.Button(new Rect(60, 240, 150, 50), GetExecutionButtonText(gm))) { Action callBack = GetExecutionButtonCallBack(gm); if (callBack != null) { callBack(); } } } else { if (GUI.Button(new Rect(60, 240, 150, 50), "Start Playing")) { StartPlayEditor(); } } #endif }
public void DeterminePhysicsMode(float kinematicMass = 1) { mode = DeterminePhysicsMode(handRigidbody, kinematicMass); }
// Update is called once per frame void Update() { if(timeElapsed <= 0 && timeResetting) { timeResetting = false; timeScale = 1; } if(timeElapsed <= antimatterResetTime) { antimatterResetTime = -1; } GetMovementInput(); GetTimeManipInput(); GetVisualModeInput(); if(!LevelManager.instance.inBounds(transform.position)) { transform.position = LevelManager.instance.reflect(transform.position); } if(!loadNextLevel && GetComponent<Camera>().fieldOfView <= 90 && (Input.GetKeyDown(KeyCode.P) || Input.GetKeyDown(KeyCode.Escape))) { gamePaused = !gamePaused; pauseMenu.GetComponent<Animator>().SetBool("GamePaused",gamePaused); if(gamePaused) { pauseMenu.GetComponent<CanvasGroup>().interactable = true; pauseMenu.transform.FindChild("PauseTitle").GetComponent<LevelIntroText>().Start(); timeReversed = false; timeFrozen = true; Cursor.visible = true; Cursor.lockState = CursorLockMode.None; } else { pauseMenu.GetComponent<CanvasGroup>().interactable = false; timeReversed = false; timeFrozen = false; Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; } } //time manipulation code if(timeFrozen) { if(timeScale < 0) { timeScale = Mathf.MoveTowards(timeScale, 0, Time.deltaTime*3f*Mathf.Abs(REVERSE_TIME_SCALE)); } else { timeScale = Mathf.MoveTowards (timeScale, 0, Time.deltaTime * 3f); } GetComponent<MotionBlur>().blurAmount = Mathf.MoveTowards(GetComponent<MotionBlur>().blurAmount, 0.5f, Time.deltaTime*3f); } else { if(timeReversed) { entangleSelected = null; if(timeElapsed <= 0) { timeReversed = false; timeResetting = false; timeElapsed = 0; noStateChangesThisFrame = true; } else { timeScale = Mathf.MoveTowards(timeScale, REVERSE_TIME_SCALE, Time.deltaTime*3f*Math.Abs(REVERSE_TIME_SCALE)); GetComponent<VignetteAndChromaticAberration>().chromaticAberration = Mathf.MoveTowards(GetComponent<VignetteAndChromaticAberration>().chromaticAberration, -timeScale*30f, Time.deltaTime*10f*Math.Abs(REVERSE_TIME_SCALE)); } } else if(timeResetting) { timeScale = -100; } else { GetComponent<VignetteAndChromaticAberration>().chromaticAberration = Mathf.MoveTowards(GetComponent<VignetteAndChromaticAberration>().chromaticAberration, 0f, Time.deltaTime * 200f); if(timeScale < 0) { timeScale = Mathf.MoveTowards(timeScale, 0, Time.deltaTime*3f*Math.Abs(REVERSE_TIME_SCALE)); } else { timeScale = Mathf.MoveTowards (timeScale, 1, Time.deltaTime * 3f); } } if(!noStateChangesThisFrame || timeReversed || timeResetting) { timeElapsed = Mathf.Max(0, timeElapsed + timeScale); noStateChangesThisFrame = true; } GetComponent<MotionBlur>().blurAmount = Mathf.MoveTowards(GetComponent<MotionBlur>().blurAmount, 0f, Time.deltaTime*3f); } //First person controls float rotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivityX; float rotationY = transform.localEulerAngles.x - Input.GetAxis("Mouse Y") * sensitivityY; if(Camera.main.fieldOfView <= 90f && !gamePaused) { transform.localEulerAngles = new Vector3(rotationY, rotationX, 0); transform.Translate(velocityVector*Time.deltaTime, Space.World); velocityVector = Vector3.MoveTowards(velocityVector, Vector3.zero, Time.deltaTime*2f); } //switching skills if(!gamePaused) { if(Input.GetKeyDown(KeyCode.Alpha1)) { currentMode = PhysicsMode.Mass; } else if(Input.GetKeyDown(KeyCode.Alpha2)) { currentMode = PhysicsMode.Charge; } else if(Input.GetKeyDown(KeyCode.Alpha3)) { currentMode = PhysicsMode.Entangle; } } RaycastHit rh = new RaycastHit(); float clipPlane = Camera.main.nearClipPlane; Camera.main.nearClipPlane = 0.1f; Ray cameraRay = Camera.main.ViewportPointToRay (new Vector3 (0.5f, 0.5f)); Camera.main.nearClipPlane = clipPlane; Debug.DrawRay(transform.position, cameraRay.direction*10f); if(!gamePaused && Physics.Raycast(cameraRay.origin,cameraRay.direction, out rh, 100000, ~(1 << 10))) { GetComponent<DepthOfField>().focalLength = Vector3.Distance(transform.position, rh.point); // GetComponent<DepthOfField>().aperture = Mathf.MoveTowards(GetComponent<DepthOfField>().aperture, 10/(Vector3.Distance(transform.position, rh.point)), Time.deltaTime*10f); if(rh.transform.gameObject.GetComponent<PhysicsModifyable>() != null) { lookingAtObject = rh.transform.gameObject; if(!wireframeMode) { lookingAtObject.GetComponent<AutoWireframeWorld>().HighlightObject(); } PhysicsModifyable pM = rh.transform.gameObject.GetComponent<PhysicsModifyable>(); rh.transform.gameObject.GetComponent<Renderer>().material.SetFloat("_Power", 0.3f); float delta = 10 * Input.mouseScrollDelta.y*Time.deltaTime; if(delta == 0) { delta = (Input.GetKeyDown(KeyCode.UpArrow) ? 0.5f : 0) + -1 * (Input.GetKeyDown(KeyCode.DownArrow) ? 0.5f : 0); } if(!timeReversed && !timeResetting && !pM.immutable) { //Increases/Decreases mass of object if(!pM.specificallyImmutable.mass && currentMode == PhysicsMode.Mass) { float tempVal = pM.Mass; pM.Mass = Mathf.Min(6, Mathf.Max(0, pM.Mass + delta)); if(pM.Mass != tempVal) { physicsSFXManager.GetComponent<PhysicsSFXManager>().PlayGravityChangeSFX(delta); } }// Increase/Decrease charge of object else if(!pM.specificallyImmutable.charge && currentMode == PhysicsMode.Charge) { if((pM.Charge == -1 && delta > 0) || (pM.Charge == 1 && delta < 0)) { pM.Charge = 0; } else if(delta != 0) { pM.Charge = Mathf.Sign(delta); } }// Quantum Entangle objects else{// if(!pM.specificallyImmutable.entangled && currentMode == PhysicsMode.Entangle) { if(Input.GetMouseButtonDown(0)) { if(pM.entangled != null) { //Debug.Log("Detangle"); pM.entangled.Entangled = null; pM.Entangled = null; entangleSelected = null; if(entangleLine != null) { Destroy(entangleLine.gameObject); } } else if(entangleSelected != null && entangleSelected != pM) { //Debug.Log("Entangle " + pM + ":" + entangleSelected); pM.Entangled = entangleSelected; entangleSelected.Entangled = pM; entangleSelected = null; if(entangleLine != null) { Destroy(entangleLine.gameObject); } } else if(!pM.specificallyImmutable.entangled){ //Debug.Log("Entangle " + pM); entangleSelected = pM; if(entangleLine == null) { entangleLine = new GameObject("EntangleLine", typeof(LineRenderer)); entangleLine.GetComponent<LineRenderer>().useWorldSpace = true; entangleLine.GetComponent<LineRenderer>().sharedMaterial = Resources.Load<GameObject>("SwitchLine").GetComponent<LineRenderer>().sharedMaterial; entangleLine.GetComponent<LineRenderer>().material.color = Color.black; entangleLine.GetComponent<LineRenderer>().SetPosition(0,pM.transform.position); } } } } if(currentMode == PhysicsMode.Mass || currentMode == PhysicsMode.Charge) { entangleSelected = null; } } } else { lookingAtObject = null; } } else if(Input.GetMouseButtonDown(0)) { // handles canceling entanglement entangleSelected = null; if(entangleLine != null) { Destroy(entangleLine.gameObject); } } else { lookingAtObject = null; } //Handles entangle indicator if(entangleLine != null) { LineRenderer entangleRenderer = entangleLine.GetComponent<LineRenderer>(); if(entangleSelected != null) { entangleRenderer.SetWidth(Vector3.Distance(transform.position,entangleSelected.transform.position)/30f,Vector3.Distance(transform.position,entangleSelected.transform.position)/30f); if(lookingAtObject == null) { entangleRenderer.SetPosition(1,transform.position + (transform.forward*Vector3.Distance(transform.position, entangleSelected.transform.position))); } else if(lookingAtObject != null && lookingAtObject.GetComponent<PhysicsModifyable>() != null) { entangleRenderer.SetPosition(1,lookingAtObject.transform.position); } } } //Loading next level with cool transition if(loadNextLevel && !loadMainMenu) { loadNextLevelTimer += Time.deltaTime; if(loadNextLevelTimer > 2f) { if(loadingNextLevel == null) { loadingNextLevel = Application.LoadLevelAsync(Application.loadedLevel + 1); if(loadingNextLevel == null) { loadingNextLevel = Application.LoadLevelAsync(0); } loadingNextLevel.allowSceneActivation = false; physicsSFXManager.GetComponent<PhysicsSFXManager>().PlayWarpingSFX(); } starField.GetComponent<ParticleSystemRenderer>().lengthScale = Mathf.MoveTowards(starField.GetComponent<ParticleSystemRenderer>().lengthScale, 100, Time.deltaTime*50f); Camera.main.fieldOfView = Mathf.MoveTowards(Camera.main.fieldOfView, 179f, Time.deltaTime*30f); transform.Translate(transform.forward*Time.deltaTime*Camera.main.fieldOfView/2f, Space.World); if(physicsSFXManager.GetComponent<AudioSource>().time/physicsSFXManager.GetComponent<AudioSource>().clip.length > 0.98f) { loadingNextLevel.allowSceneActivation = true; } } } else if (!loadNextLevel && !loadMainMenu) { starField.GetComponent<ParticleSystemRenderer>().lengthScale = Mathf.MoveTowards(starField.GetComponent<ParticleSystemRenderer>().lengthScale, 1, Time.deltaTime*50f); Camera.main.fieldOfView = Mathf.MoveTowards(Camera.main.fieldOfView, 90f, Time.deltaTime*Camera.main.fieldOfView/3f); if(Camera.main.fieldOfView > 90f) { transform.Translate(transform.forward*Time.deltaTime*10f, Space.World); } } else if(loadNextLevel && loadMainMenu) { lookingAtObject = null; loadNextLevelTimer += Time.deltaTime; if(loadNextLevelTimer > 0.2f) { if(loadingNextLevel == null) { StartCoroutine(LoadMainMenuSeamlessly()); loadingNextLevel.allowSceneActivation = false; physicsSFXManager.GetComponent<PhysicsSFXManager>().PlayWarpingSFX(); } starField.GetComponent<ParticleSystemRenderer>().lengthScale = Mathf.MoveTowards(starField.GetComponent<ParticleSystemRenderer>().lengthScale, 100, Time.deltaTime*50f); starField.transform.localPosition = new Vector3(0f, 0f, -300f); Camera.main.fieldOfView = Mathf.MoveTowards(Camera.main.fieldOfView, 179f, Time.deltaTime*30f); transform.Translate(-transform.forward*Time.deltaTime*Camera.main.fieldOfView/2f, Space.World); if(physicsSFXManager.GetComponent<AudioSource>().time/physicsSFXManager.GetComponent<AudioSource>().clip.length > 0.98f) { Cursor.visible = true; Cursor.lockState = CursorLockMode.None; loadingNextLevel.allowSceneActivation = true; } } } }
/// <summary> /// ctor /// </summary> protected IncompressibleBoundaryCondMap(IGridData f, IDictionary <string, AppControl.BoundaryValueCollection> b, PhysicsMode _PhysicsMode, string[] BndFuncName) : base(f, b, BndFuncName) { this.PhysMode = _PhysicsMode; }
/// <summary> /// ctor /// </summary> public IncompressibleBoundaryCondMap(IGridData f, IDictionary <string, AppControl.BoundaryValueCollection> b, PhysicsMode _PhysicsMode) : base(f, b, BndFunctions(f, _PhysicsMode)) { this.PhysMode = _PhysicsMode; }