// Update is called once per frame void Update() { // This is the correct time to expose CAPI if (FirstUpdate) { if (ExposeCAPI) { ExposeCapi(); } //ReturnActiveState(false, gameObject); FirstUpdate = false; //FirstContent.GetComponent<Text>().text = CreateTimeStamp() + FirstContent.GetComponent<Text>().text; // Toggle kludge transform.GetChild(0).gameObject.SetActive(true); } if (CreateNewContentObject) { CreateNewContent(); CreateNewContentObject = false; Capi.set(CAPI_Name + ".CreateNewFeedback", CreateNewContentObject); //UpdateObjectiveText("DEERP"); } if (CreateNewWebContentObject) { CreateNewWebLinkContent(); CreateNewWebContentObject = false; Capi.set(CAPI_Name + ".CreateNewWebLink", CreateNewWebContentObject); } }
// Update is called once per frame void Update() { if (ExposeCapi) { ExposeCAPI(); CapiExposed = true; ExposeCapi = false; } if (TriggerFlash) { StartFlash(); TriggerFlash = false; if (CapiExposed) { Capi.set("UI." + gameObject.name + ".TriggerFlash", TriggerFlash); } } if (DisableFlash) { StartCoroutine(FadeOut()); DisableFlash = false; } if (DoAutoFlash) { StartCoroutine(AutoFlashMagic()); DoAutoFlash = false; } }
void Update() { if (FirstUpdate) { //Debug.Log(transform.parent.name + " | " + FirstUpdate.ToString()); ExposeMyCapi(); FirstUpdate = !FirstUpdate; } if (AddNamePlate) { AutoAddInfoPlate(); AddNamePlate = !AddNamePlate; Capi.set(transform.parent.name + ".AddNameplate", AddNamePlate); } if (AddOrbitalPath) { CreateOrbitalPath(); AddOrbitalPath = !AddOrbitalPath; Capi.set(transform.parent.name + ".AddOrbitalPath", AddOrbitalPath); } //NB:04/20/2018 if (WipeOrbitalPath) { RemoveOrbitalPath(); WipeOrbitalPath = false; } ScaleByDistance(); }
void Update() { if (UpdateCapi) { ExposeMyCapi(); CapiUpdated = true; UpdateCapi = !UpdateCapi; } if (UpdateLineSize) { ResizeLine(); UpdateLineSize = !UpdateLineSize; Debug.Log("Resizing line!"); Capi.set(gameObject.name + ".ResizeLine", UpdateLineSize); } if (OrientSelf) { transform.LookAt(MyTarget); transform.rotation = Quaternion.Euler(90.0f, transform.rotation.eulerAngles.y, transform.rotation.eulerAngles.z + CatchupOffset); } if (FirstUpdate) { gameObject.name = MyTarget.name + " Orbital Path"; FirstUpdate = false; } }
public void ToggleObjectActive() { ObjectToToggle.SetActive(!ObjectToToggle.activeSelf); gameObject.GetComponent <Button>().interactable = false; Blackground.color = Color.gray; if (HaveSound) { MySoundBoard.PlayCertainClip(2); } if (UIToToggle != null) { UIToToggle.SetActive(!UIToToggle.activeSelf); } if (MySceneController.AllowNextOnCacheCase) // && !ObjectToToggle.activeSelf) { MySceneController.TriggerCheckEvent(); MySceneController.AllowNextOnCacheCase = false; Capi.set("System.AllowNextOnCacheCase", false); } StartCoroutine(DelayNextClick()); //ToggleButton = ObjectToToggle.activeSelf; Capi.set("UI." + CAPIName + "Toggle", ToggleButton); }
// This only sets spherical radii // JOS: 8/10/2016 private float SetRadius(float _x) { xradius = _x; yradius = _x; Capi.set(gameObject.name + ".Radius", xradius); Debug.Log(gameObject.name + " radius was set to " + xradius.ToString()); return(_x); }
// A crude way of clamping the value. // JOS: 10/7/2016 private float ChangeAssessmentMode() { AssessmentMode = Mathf.Clamp(AssessmentMode, 0, 3); Capi.set("Module 1 Assessment.Mode", AssessmentMode); return(AssessmentMode); }
public string ReturnFormattedText(string _text, string _textToReplace) { _textToReplace = _text.Replace("\\n", "\n"); Capi.set(CAPI_Name + ".Text", _textToReplace); MyFeedbackText = _textToReplace; return(_textToReplace); }
public float UpdateWorldSpeedAndSlider(float _speed) { CurrentTime = _speed; SpeedSlider.value = _speed; Capi.set("Globals.WorldSpeed", _speed); return(_speed); }
public void InitiateSimRestart() { SimWantsToRestart = true; Capi.set("System.Restart.Sim Wants To Restart", SimWantsToRestart); //MyImage.CrossFadeColor(gameObject.GetComponent<Button>().colors.pressedColor, 0.25f, false, false); //gameObject.GetComponent<Button>().interactable = false; StartCoroutine(DelayTheRestart()); }
public void OnFingerDown(Lean.LeanFinger finger) { // Raycast information Ray ray = finger.GetRay(CameraToUse); RaycastHit hit; if (MySceneController.GetComponent <SceneController>().LockTarget == false) { // Was this finger pressed down on a collider? if (Physics.Raycast(ray, out hit, Mathf.Infinity, LayerMask) == true) { // Was that collider this one? if ((hit.collider.gameObject.transform.parent == gameObject.transform.parent) && (hit.collider.gameObject.layer != 9) && (!Studied)) { // Set the current finger to this one draggingFinger = finger; _SceneControllerRef._selected = hit.collider.gameObject.transform.parent.gameObject; _SceneControllerRef.SelectedObjectType = MySceneController.GetComponent <SceneController>()._selected.GetComponent <OrbitalMovement>().MyObjectType.ToString(); Capi.set("Globals.SelectedObject", MySceneController.GetComponent <SceneController>()._selected.name); Capi.set("Globals.SelectedObjectType", MySceneController.GetComponent <SceneController>()._selected.GetComponent <OrbitalMovement>().MyObjectType.ToString()); CUPCamera.gameObject.GetComponent <CloseUpCamera>().SetMinAndMaxZoom(CloseUpMaxDistance, CloseUpMinDistance, CloseUpStartPercentage); Reticle = GameObject.Find("Reticle ENV"); Reticle.GetComponent <ReticleTracker>().FacingIndicator.transform.position = MySceneController.GetComponent <SceneController>()._selected.transform.position; if (Studied) { Reticle.transform.GetChild(0).GetComponent <Image>().sprite = Reticle.GetComponent <ReticleTracker>().BadTargetReticle; //Reticle.GetComponent<Image>().color = Color.red; Reticle.GetComponent <RectTransform>().localEulerAngles = new Vector3(0.0f, 0.0f, 0.0f); } else { //Debug.Log("CHECK"); Reticle.transform.GetChild(0).GetComponent <Image>().sprite = Reticle.GetComponent <ReticleTracker>().OriginalImage; //Reticle.GetComponent<Image>().color = Color.yellow; Reticle.GetComponent <RectTransform>().localEulerAngles = new Vector3(0.0f, 0.0f, 0.0f); } RepositionReticle(MySceneController.GetComponent <SceneController>()._selected); //UpdateOrbitalZoneInfo(); CUPCamera.gameObject.GetComponent <CloseUpCamera>().target = MySceneController.GetComponent <SceneController>()._selected.transform; MyFactoidController.CurrentDataset = transform.parent.GetComponent <OrbitalMovement>(); MyFactoidController.FixMyFactoids(); //_SceneControllerRef.ProbeTargetLabel.text = hit.collider.gameObject.transform.parent.gameObject.name; _SceneControllerRef.TriggerCheckEvent(); } } } }
public void OnFingerUp(Lean.LeanFinger finger) { if (!CustomCapiNames) { Capi.set("Camera.SSV.Zoom Level", MyZoomSlider.value); } else { Capi.set("Camera." + gameObject.name + ".Zoom Level", MyZoomSlider.value); } }
private void PerformAssessment(float _testType) { int _Mode = (int)AssessmentMode; switch (_Mode) { case 0: // Default Debug.Log("NO ASSESSMENT MODE SET"); break; case 1: // NEO if (_MyTestObjectOrbitInfo.radius >= NEOZoneBoundaries.x && _MyTestObjectOrbitInfo.radius <= NEOZoneBoundaries.y) { NEOZoneCorrect = true; Capi.set("Module 1 Assessment.NEO Zone Correct", NEOZoneCorrect); } else { //ResetAssessmentState = true; } break; case 2: // MAB if (_MyTestObjectOrbitInfo.radius >= MABZoneBoundaries.x && _MyTestObjectOrbitInfo.radius <= MABZoneBoundaries.y) { MABZoneCorrect = true; Capi.set("Module 1 Assessment.MAB Zone Correct", MABZoneCorrect); } else { //ResetAssessmentState = true; } break; case 3: // KBO if (_MyTestObjectOrbitInfo.radius >= KBOZoneBoundaries.x && _MyTestObjectOrbitInfo.radius <= KBOZoneBoundaries.y) { KBOZoneCorrect = true; Capi.set("Module 1 Assessment.KB Zone Correct", KBOZoneCorrect); } else { //ResetAssessmentState = true; } break; default: Debug.Log("INVALID ASSESSMENT VALUE"); break; } MySceneController.TriggerCheckEvent(); }
public void FoundCache() { switch (MyType) { case SmallWorldType.MAB: _MySceneController.MBO_Found++; Capi.set("Globals.MBOs Found", _MySceneController.MBO_Found); _MySceneController.TrophyCase.transform.Find("Toggle Cache Case").GetChild(3).GetChild(0).GetComponent <Text>().text = (_MySceneController.MBO_Found.ToString() + "/" + _MySceneController.MaxObjectsToFind.ToString()); //_MySceneController.ToggleCUP = true; StartCoroutine(SetStudied()); StartCoroutine(BlowUpCoinCache()); MyReticle.MyTarget = ClearReticleTarget; CacheCase.Find("ToggleBoxMAB").transform.GetChild(0).GetComponent <SpinMeRightRoundBaby>().ToggleShownCoins(); break; case SmallWorldType.OCO: break; case SmallWorldType.NEO: _MySceneController.NEO_Found++; Capi.set("Globals.NEOs Found", _MySceneController.NEO_Found); _MySceneController.TrophyCase.transform.Find("Toggle Cache Case").GetChild(2).GetChild(0).GetComponent <Text>().text = (_MySceneController.NEO_Found.ToString() + "/" + _MySceneController.MaxObjectsToFind.ToString()); //_MySceneController.ToggleCUP = true; StartCoroutine(SetStudied()); StartCoroutine(BlowUpCoinCache()); MyReticle.MyTarget = ClearReticleTarget; CacheCase.Find("ToggleBoxNEO").transform.GetChild(0).GetComponent <SpinMeRightRoundBaby>().ToggleShownCoins(); break; case SmallWorldType.KB: _MySceneController.KBO_Found++; Capi.set("Globals.KBOs Found", _MySceneController.KBO_Found); _MySceneController.TrophyCase.transform.Find("Toggle Cache Case").GetChild(4).GetChild(0).GetComponent <Text>().text = (_MySceneController.KBO_Found.ToString() + "/" + _MySceneController.MaxObjectsToFind.ToString()); //_MySceneController.ToggleCUP = true; StartCoroutine(SetStudied()); StartCoroutine(BlowUpCoinCache()); MyReticle.MyTarget = ClearReticleTarget; CacheCase.Find("ToggleBoxKBO").transform.GetChild(0).GetComponent <SpinMeRightRoundBaby>().ToggleShownCoins(); break; default: // obvs totes do nada break; } }
public void UpdateCapi() { if (Application.platform == RuntimePlatform.WebGLPlayer) { Capi.set(gameObject.name + ".distance", radius); Capi.set(gameObject.name + ".OrbitSpeed", rotationSpeed); Capi.set(gameObject.name + ".UpdatePosition", UpdateStagePosition); Capi.set(gameObject.name + ".Position.x", transform.position.x); Capi.set(gameObject.name + ".Position.y", transform.position.y); Capi.set(gameObject.name + ".Position.z", transform.position.z); } }
// Update is called once per frame void Update() { if (FirstUpdate) { FirstUpdate = false; ExposeCAPI(); } if (MyTarget != null && RepositionReticle) { MyRect.position = Camera.main.WorldToScreenPoint(MyTarget.transform.position); Vector3 _tPos = new Vector3(MyRect.position.x - (RepositionOffset.x), MyRect.position.y - (RepositionOffset.y), MyRect.position.z); MyRect.position = _tPos; } //Debug.DrawLine(MyTarget.transform.position, MyCamera.transform.position); //_DoDraw = IsInFront(MyTarget); _DoDraw = IsInFrontByAngles(MyTarget); if (ResetReticle) { MyTarget = _OriginalTarget; ResetReticle = false; Capi.set("System.Reset Reticle", ResetReticle); } if (_DoDraw) { if (_MyImage.enabled) { // JIC block } else { _MyImage.enabled = true; _MyText.enabled = true; } } else { if (_MyImage.enabled) { _MyImage.enabled = false; _MyText.enabled = false; } else { // JIC block } } }
//NB: 04/18/2018 // Use this method to wipe a worldset from the scene private void WipeWorldSet(Transform _WorldSet, int _index) { Debug.Log("WipeWorldSet"); foreach (Transform _child in _WorldSet) { Debug.Log("Wiping " + _child.name); //Debug.Log(LocatedBits[_index]); Debug.Log(_child.name + " now wiping"); _child.GetChild(3).GetComponent <SelectOrbitalObject>().AddOrbitalPath = false; _child.GetChild(3).GetComponent <SelectOrbitalObject>().AddNamePlate = false; _child.GetChild(3).GetComponent <SelectOrbitalObject>().WipeOrbitalPath = true; _child.GetChild(3).GetComponent <SelectOrbitalObject>().Studied = false; Capi.set(_child.name + ".CacheFound", _child.GetChild(3).GetComponent <SelectOrbitalObject>().Studied); } }
// Temporarily disable trigger events. // JOS : 8/23/2016 private IEnumerator SuspendTriggerEvents() { //Debug.Log("SuspendTriggerEvents()"); AllowSimTriggers = false; Capi.set("System.AllowSimTriggers", AllowSimTriggers); yield return(new WaitForSeconds(1.0f)); AllowSimTriggers = true; AllowDelayedSimTriggers = true; Capi.set("System.AllowSimTriggers", AllowSimTriggers); Capi.set("System.AllowDelayedSimTriggers", AllowDelayedSimTriggers); yield return(null); }
// Update is called once per frame void Update() { if (FirstUpdate) { ExposeCapi(); FirstUpdate = false; } if (ResetAssessmentState) { ResetMyAssessment(); ResetAssessmentState = false; Capi.set("Module 1 Assessment.Reset Assessment", ResetAssessmentState); } }
// Update is called once per frame void Update() { if (DoCapiExpose) { ExposeCAPI(); DoCapiExpose = false; } if (PlaySelectedSound) { PlayClips(); PlaySelectedSound = false; Capi.set(gameObject.name + ".PlaySelectedSound", PlaySelectedSound); } }
void Update() { if (ShowZone) { SortZoneBoundaries(); MyZoneFlasher.ToggleZone = true; ShowZone = !ShowZone; Capi.set("UI.Minimap.FlashZone", ShowZone); } if (ExposeCAPI) { ExposeCapi(); ExposeCAPI = false; } }
// Update is called once per frame void Update() { if (ExposeCapi) { ExposeMyCapi(); ExposeCapi = false; } if (ToggleButton) { // This following code lives here because the above function can be triggered by the sim or SPR. // If it were folded into the above function, we would be making extra CAPI calls to SPR when the // sim button is used. The boolean here used to enter this block is ONLY used by SPR. // To be explicit, a SIM button can simply call the above function directly. // JOS: 8/12/2016 ToggleObjectActive(); ToggleButton = !ToggleButton; Capi.set("UI." + CAPIName + "Toggle", ToggleButton); } }
// Use this method to load found worlds private void LoadUpWorlds(Transform _WorldSet, int _index) { foreach (Transform _child in _WorldSet) { //Debug.Log(_child.name); //Debug.Log(LocatedBits[_index]); if (_child.GetComponent <OrbitalMovement>() != null) { if (UserFlagExtensions.Contains(LocatedBits[_index], _child.GetComponent <OrbitalMovement>().MySaveFlag)) { //Debug.Log(_child.GetComponent<OrbitalMovement>().MySaveFlag.ToString() + " | " + LocatedBits[_index]); Debug.Log(_child.name + " now loading"); _child.GetChild(3).GetComponent <SelectOrbitalObject>().AddOrbitalPath = true; _child.GetChild(3).GetComponent <SelectOrbitalObject>().AddNamePlate = true; _child.GetChild(3).GetComponent <SelectOrbitalObject>().Studied = true; Capi.set(_child.name + ".CacheFound", _child.GetChild(3).GetComponent <SelectOrbitalObject>().Studied); _child.GetChild(4).GetChild(1).GetComponent <UpdateTrophyCase>().FoundCache(); } } } }
public void TriggerDelayedCheckEvent() { if (AllowDelayedSimTriggers) { TriggerDeferment = NextScreenDelay; StartCoroutine(DeferTriggerCheck()); AllowDelayedSimTriggers = false; Capi.set("System.AllowDelayedSimTriggers", false); Debug.Log("Delayed trigger initiated"); } else { Debug.Log("Sim not allowed to trigger deferred check events."); // Kludge! // JOS: 03/16/2017 if (AllowNextOnCacheCase) { StartCoroutine(ResetTriggers()); } } }
public IEnumerator SetStudied() { DisableMyCache(); _MySceneController.SPR_FoundCache = true; Capi.set("Globals.SPR FoundCache", _MySceneController.SPR_FoundCache); yield return(new WaitForSeconds(0.5f)); AddInfoPlates(); UpdateCoinCaseData(); if (_MySceneController._selected.transform.GetChild(3).gameObject.GetComponent <SelectOrbitalObject>() != null) { _MySceneController._selected.transform.GetChild(3).gameObject.GetComponent <SelectOrbitalObject>().Studied = true; if (_MySceneController._OrbitalZoneFlasher.CurrentFlashState == true) { _MySceneController._OrbitalZoneFlasher.StartCoroutine(_MySceneController._OrbitalZoneFlasher.FadeOut()); _MySceneController._OrbitalZoneFlasher.CurrentFlashState = false; } Capi.set(transform.parent.parent.name + ".CacheFound", _MySceneController._selected.transform.GetChild(3).gameObject.GetComponent <SelectOrbitalObject>().Studied); _MySceneController.transform.GetComponent <SPR_LocalData>().FlipBits(transform.parent.parent.GetComponent <OrbitalMovement>().MySaveFlag, transform.parent.parent.GetComponent <OrbitalMovement>().MyObjectType); } // Only do this if we're not currently loading. if (_MySceneController.gameObject.GetComponent <SPR_LocalData>().CurrentlyLoadingSaveData == false) { //Debug.Log("<color=green>Triggering check event quickly!</color>"); _MySceneController.TriggerCheckEventNOW(); } else { //Debug.Log("<color=red>TriggerCheckEventNow() blocked by kludge!</color>"); } //Application.ExternalCall("SendMessageToUnity", true); yield return(null); }
// Update is called once per frame void Update() { if (ToggleZone) { if (UseSceneControllerData) { _MySceneController.SetCurrentZoneData = true; } StartCoroutine(FlashZone()); ToggleZone = !ToggleZone; if (CapiExposed) { Capi.set(gameObject.name + ".FlashZone", ToggleZone); } } if (ForceFadeOut && (CurrentFlashState == true)) { StartCoroutine(FadeOut()); CurrentFlashState = false; ForceFadeOut = !ForceFadeOut; Capi.set("Globals.FadeZone", ForceFadeOut); } else if (ForceFadeOut) { ForceFadeOut = !ForceFadeOut; Capi.set("Globals.FadeZone", ForceFadeOut); } if (ExposeCapi) { ExposeCAPI(); ExposeCapi = false; } }
//NB:04/20/2018 //Method to call from SPR_Local_Data after find ResetData was true public void SetResetData(bool reset) { Debug.Log("Setting ResetData to " + reset); ResetData = reset; Capi.set("Globals.ResetData", ResetData); }
public void OnFingerUp(Lean.LeanFinger finger) { Capi.set("Globals.WorldSpeed", SceneController.GetComponent <SceneController>().CurrentTime); }
public void OnFingerUp(Lean.LeanFinger finger) { TouchedElement = null; Capi.set("Camera.Rotation.x", transform.rotation.x); Capi.set("Camera.Rotation.y", transform.parent.rotation.y); }
// Update is called once per frame void Update() { if (FirstUpdate) { // This exposes the parent DOM Application.ExternalCall("UnityWantsViewerAccess", true); // This exposes CAPI! ExposeMyCapi(); FirstUpdate = false; } else { // DERP } // Despite this variable name, it defers the loading for 1 sec to allow things to synchronize. // We don't wait for a callback on this because it ends up queued. It just has to arrive after other messages. // JOS: 1/18/2017 if (SaveDataRightNow) { StartCoroutine(DelayedSaveCurrentData()); SaveDataRightNow = !SaveDataRightNow; Capi.set("System.Save Current Data Now", SaveDataRightNow); } if (SetCurrentZoneData) { AlterOrbitalZoneInfo(SetCurrentZoneWidth, SetCurrentZoneMidpoint, _OrbitalZonePath); SetCurrentZoneData = !SetCurrentZoneData; Capi.set("UI.Minimap.SetCurrentZone", SetCurrentZoneData); } if (ToggleSSV) { MyTogglePanel.GetComponent <TogglePanel>().SSV_ENVFade(); ToggleSSV = !ToggleSSV; ReparentOrbitalLines(); Capi.set("Globals.ToggleSSV", ToggleSSV); } if (ToggleCUP) { if (!CUPCamera.GetComponent <Camera>().enabled) { //Debug.Log("MAKING ROKKIT NOIZ"); SoundBoard.GetComponent <AudioSource>().PlayOneShot(CUPTransitionSound); } MyTogglePanel.GetComponent <TogglePanel>().CUP_ENVFade(); ToggleCUP = !ToggleCUP; Capi.set("Globals.ToggleCUP", ToggleCUP); } if (Starfield) { _skyBoxToggle.GetComponent <ToggleSkyBox>().ToggleSky(); Starfield = !Starfield; Capi.set("Globals.Starfield", Starfield); } if (PPToggle) { PauseGame(); PPToggle = !PPToggle; Capi.set("Globals.Pause", PPToggle); } if (DrawTestObjects) { //TestObjectDragMenuObject.GetComponent<DragMe>().MakeENVObjects(); //DrawTestObjects = false; //Capi.setInternal("DrawTestObjects", false); } if (DrawKBOGroup) { ToggleKBOGroup(); DrawKBOGroup = false; Capi.set("ENV.ToggleKBOGroup", DrawKBOGroup); } if (DrawMBOGroup) { ToggleMBOGroup(); DrawMBOGroup = false; Capi.set("ENV.ToggleMBOGroup", DrawMBOGroup); } if (DrawNEOGroup) { ToggleNEOGroup(); DrawNEOGroup = false; Capi.set("ENV.ToggleNEOGroup", DrawNEOGroup); } if (ShowNEOAssessmentLines) { ShowAssessmentLinesNEO(); ShowNEOAssessmentLines = false; Capi.set("Module 1 Assessment.Toggle NEO Orbit Lines", ShowNEOAssessmentLines); } if (ShowMABAssessmentLines) { ShowAssessmentLinesMAB(); ShowMABAssessmentLines = false; Capi.set("Module 1 Assessment.Toggle MAB Orbit Lines", ShowMABAssessmentLines); } if (ShowKBOAssessmentLines) { ShowAssessmentLinesKBO(); ShowKBOAssessmentLines = false; Capi.set("Module 1 Assessment.Toggle KBO Orbit Lines", ShowKBOAssessmentLines); } if (TriggerDelayedNext) { TriggerDelayedCheckEvent(); TriggerDelayedNext = false; Capi.set("System.Trigger Delayed Next", TriggerDelayedNext); } //SwitchSkybox(); //NB:04/15/2018 //call WipeSaveData() if ResetData is true (should only be true at the first task) if (ResetData && !_DataHasBeenReset) { Debug.Log("In Scene Controller, ResetData: " + ResetData); Debug.Log("Wiping Data"); _DataHasBeenReset = true; gameObject.GetComponent <SPR_LocalData>().WipeSaveData(); } }