void OnMouseUp() { if (null != SelectSound) { SelectSound.PlayOneShot(SelectSound.clip); } switch (ControlState) { case RodStatus.Up: ControlState = RodStatus.MovingDown; if (venting) { venting = false; VentingTime = 0; } break; case RodStatus.MovingUp: ControlState = RodStatus.MovingDown; if (venting) { venting = false; VentingTime = 0; } break; default: break; } }
void OnMouseUp() { switch (ControlState) { case RodStatus.Up: ControlState = RodStatus.MovingDown; if (venting) { venting = false; VentingTime = 0; } break; case RodStatus.MovingUp: ControlState = RodStatus.MovingDown; if (venting) { venting = false; VentingTime = 0; } break; default: break; } }
void Start() { container = GameObject.Find("Win Overlay"); //rod = GameObject.Find("NetworkView_TestObject"); status = RodStatus.rodstatus; showingUI = false; startPos = container.transform.position; onScreenPos = new Vector3(container.transform.position.x, (Screen.height/3)*1.5f, container.transform.position.z); }
// Use this for initialization void Start() { source = GetComponent<AudioSource>(); barY = 15; barX = Screen.width / 2; status = RodStatus.rodstatus; bobber = status.bobber; rodEnd = status.rodEnd; defaultSize = barSize; compass = Instantiate(compass, transform.position, Quaternion.identity) as GameObject; }
public void OnMouseUp() { if (null != SelectSound) { SelectSound.PlayOneShot(SelectSound.clip); } switch (ControlState) { case RodStatus.Up: ControlState = RodStatus.MovingDown; if (venting) { venting = false; VentingTime = 0; LastClickGood = false; } else { TimesFixed += 1; LastClickGood = true; } break; case RodStatus.MovingUp: ControlState = RodStatus.MovingDown; if (venting) { venting = false; VentingTime = 0; LastClickGood = false; } else { TimesFixed += 1; LastClickGood = true; } break; default: LastClickGood = false; break; } }
void ProcessCoreState() { switch (ControlState) { case RodStatus.Up: if (venting) { VentingTime += Time.deltaTime; if (VentingTime >= 2.0f) { venting = false; // The code to do something when it's been venting for 2 seconds should go here. } } break; case RodStatus.MovingDown: if (!ControlRod.transform.localPosition.Equals(DownPosition.localPosition)) { ControlRod.transform.localPosition = Vector3.Lerp(ControlRod.transform.localPosition, DownPosition.localPosition, Time.deltaTime); float distance = Vector3.Distance(ControlRod.transform.localPosition, DownPosition.localPosition); if (distance <= 0.025f) { ControlRod.transform.localPosition = DownPosition.localPosition; ControlRod.transform.localPosition = new Vector3(DownPosition.localPosition.x, DownPosition.localPosition.y, DownPosition.localPosition.z); } } else { ControlState = RodStatus.Down; } break; case RodStatus.Selected: ControlState = RodStatus.MovingUp; ControlRod.transform.localPosition = Vector3.Lerp(ControlRod.transform.localPosition, UpPosition.localPosition, Time.deltaTime); break; case RodStatus.MovingUp: if (!ControlRod.transform.localPosition.Equals(UpPosition.localPosition)) { ControlRod.transform.localPosition = Vector3.Lerp(ControlRod.transform.localPosition, UpPosition.localPosition, Time.deltaTime); float distance = Vector3.Distance(ControlRod.transform.localPosition, UpPosition.localPosition); if (distance <= 0.025f) { ControlRod.transform.localPosition = UpPosition.localPosition; ControlRod.transform.localPosition = new Vector3(UpPosition.localPosition.x, UpPosition.localPosition.y, UpPosition.localPosition.z); } } else { ControlState = RodStatus.Up; Debug.Log("Rod is up"); venting = true; } break; default: break; } }
void Awake() { rodstatus = this; }
void ProcessCoreState() { switch (ControlState) { case RodStatus.Up: if (null != CoreGlow) { CoreGlow.color = Color.Lerp(CoreGlow.color, VentingColor, Time.deltaTime); } break; case RodStatus.MovingDown: if (null != CoreGlow) { CoreGlow.color = Color.Lerp(CoreGlow.color, StabilizingColor, Time.deltaTime); } if (!ControlRod.transform.localPosition.Equals(DownPosition.localPosition)) { ControlRod.transform.localPosition = Vector3.Lerp(ControlRod.transform.localPosition, DownPosition.localPosition, Time.deltaTime); float distance = Vector3.Distance(ControlRod.transform.localPosition, DownPosition.localPosition); if (distance <= 0.025f) { ControlRod.transform.localPosition = DownPosition.localPosition; ControlRod.transform.localPosition = new Vector3(DownPosition.localPosition.x, DownPosition.localPosition.y, DownPosition.localPosition.z); } } else { ControlState = RodStatus.Down; } break; case RodStatus.Selected: if (null != CoreGlow) { CoreGlow.color = Color.Lerp(CoreGlow.color, DestabilizingColor, Time.deltaTime); } ControlState = RodStatus.MovingUp; ControlRod.transform.localPosition = Vector3.Lerp(ControlRod.transform.localPosition, UpPosition.localPosition, Time.deltaTime); break; case RodStatus.MovingUp: if (null != CoreGlow) { CoreGlow.color = Color.Lerp(CoreGlow.color, RodFailureColor, Time.deltaTime); } if (!ControlRod.transform.localPosition.Equals(UpPosition.localPosition)) { ControlRod.transform.localPosition = Vector3.Lerp(ControlRod.transform.localPosition, UpPosition.localPosition, Time.deltaTime); float distance = Vector3.Distance(ControlRod.transform.localPosition, UpPosition.localPosition); if (distance <= 0.025f) { ControlRod.transform.localPosition = UpPosition.localPosition; ControlRod.transform.localPosition = new Vector3(UpPosition.localPosition.x, UpPosition.localPosition.y, UpPosition.localPosition.z); } } else { ControlState = RodStatus.Up; Debug.Log("Rod is up"); venting = true; } break; default: if (null != CoreGlow) { CoreGlow.color = Color.Lerp(CoreGlow.color, NominalColor, Time.deltaTime); } break; } }
void Start() { rod = GameObject.Find("NetworkView_TestObject(Clone)"); status = RodStatus.rodstatus; }