private IEnumerator DoToggleDebug() { _active = !_active; StatusContent sc = Camera.main.GetComponentInChildren <StatusContent>(); sc.OnStatusChange((_active ? "Activating " : "Deactivating ") + "debug info", (int)_delay); yield return(new WaitForSeconds(_delay)); if (!Common.IsPointerLookingToGameObject(gameObject)) { sc.OnStatusChange("Idle."); yield break; } for (int _i = 0; _i < DebugDisplays.Length; _i++) { if (DebugDisplays[_i] != null) { DebugDisplays[_i].SetActive(_active); } } sc.OnStatusChange("Idle."); }
private IEnumerator Launch(Rigidbody rigidbody, Vector3 force = default(Vector3)) { _countTime = Time.time; if (_trajectoryRenderer.positionCount > 0) { _points.Clear(); _trajectoryRenderer.positionCount = 0; _trajectoryRenderer.SetPositions(_points.ToArray()); } _isTrajectoryDrawn = false; var goLO = rigidbody.gameObject.GetComponent <LaunchableObject>(); StatusContent sc = Camera.main.GetComponentInChildren <StatusContent>(); sc.OnStatusChange("Launching in", (int)_preLaunchDelay); yield return(new WaitForSeconds(_preLaunchDelay)); if (!Common.IsPointerLookingToGameObject(rigidbody.gameObject)) { MakeBallLaunchable(rigidbody.gameObject); sc.OnStatusChange("Idle."); yield break; } rigidbody.AddForce(force != default(Vector3) ? force : LaunchForce, ForceMode.Impulse); sc.OnStartPlayerAnimation(true); sc.OnStatusSFXPlay(true); sc.OnStatusChange("Launched!"); yield return(new WaitForSeconds(_postLaunchDelay)); sc.OnStatusChange("Idle."); goLO.IsLaunched = true; }