/// <summary> /// Sets a new axle orientation /// </summary> /// <param name="orientation">The new orientation</param> private void UpdateAxle(AxleOrientation orientation) { m_axleOrientation = orientation; switch (m_axleOrientation) { case (AxleOrientation.VERTICAL): Quaternion verticalRotation = Quaternion.Euler(m_verticalRotation); m_bladeAssembly.transform.localRotation = verticalRotation; break; case (AxleOrientation.HORIZONTAL): Quaternion horizontalRotation = Quaternion.Euler(m_horizontalRotation); m_bladeAssembly.transform.localRotation = horizontalRotation; break; default: Debug.LogError("Invalid AxleOrientation passed through on UpdateAxle()"); break; } }
/// <summary> /// Randomly sets a blade orientation and sets the correct rotation /// </summary> private void CreateAxle() { //Randomly sets a configuration for the axle m_axleOrientation = (AxleOrientation)Random.Range(0, 2); switch (m_axleOrientation) { case (AxleOrientation.VERTICAL): Quaternion verticalRotation = Quaternion.Euler(m_verticalRotation); m_bladeAssembly.transform.localRotation = verticalRotation; break; case (AxleOrientation.HORIZONTAL): Quaternion horizontalRotation = Quaternion.Euler(m_horizontalRotation); m_bladeAssembly.transform.localRotation = horizontalRotation; break; default: Debug.LogError("Invalid AxleOrientation randomised on CreateAxle()" + ""); break; } }
/// <summary> /// Calls base fix machine, also randomly sets a new value for all the variables /// </summary> public override void FixMachine() { //call base function base.FixMachine(); //randomly generate new variables AxleOrientation newAxles = (AxleOrientation)Random.Range(0, 2); BladeSpinDirection newSpin = (BladeSpinDirection)Random.Range(0, 2); RattlingPipe newRattle = (RattlingPipe)Random.Range(0, 4); RotationRate newRotateSpeed = (RotationRate)Random.Range(0, 5); PressureGauge newPressure = (PressureGauge)Random.Range(0, 5); //Hide variables StopRattlingPipe(); //TODO close panels //update all the variables UpdateAxle(newAxles); UpdateBlades(newSpin); UpdateRattlingPipe(newRattle); UpdateRotationRate(newRotateSpeed); UpdatePressure(newPressure); }