void OnDisable() { // Must spend at least one second in a level, prevents a bit of log spam from the scene juggling. if (timer > 1f) { SimpleData.WriteDataPoint("Left_Scene", "", "", "", "", ""); //SimpleData.WriteStringToFile ("TimeSpent.txt", Time.time + ",TIMESPENT_INLEVEL," + sceneName + "," + timer); // If the next line is commented, system is additive, and will print the // total time spent in a level every time the object is disabled. timer = 0f; } }
void Update() { timer += Time.deltaTime; //enter highland // TODO: change this so that separation is more definition if (!highland) { if (sceneName == "Canyon2" && playerPos.position.y >= 33) { //Debug.Log("here"); SimpleData.WriteDataPoint("Left_Scene", "", "", "", "", ""); //SimpleData.WriteStringToFile ("TimeSpent.txt", Time.time + ",TIMESPENT_INLEVEL," + sceneName + "," + timer); timer = 0f; highland = true; } } }
void Start() { invController = transform.parent.parent.GetComponent <InventoryController>(); indicator_s = indicator; // Need to ignore static limitations... build = GetComponent <Button>(); build.interactable = false; indicator.SetActive(false); build.onClick.AddListener(() => { // Save player info before entering. // TODO: re-implement for final version of game? InventoryController.levelName = SceneManager.GetActiveScene().name; // Record data. SimpleData.WriteDataPoint("Constructing_Item", "", "", "", "", whatToBuild); //SimpleData.WriteStringToFile("ModeSwitches.txt", Time.time + ",MODESWITCH_TO," + whatToBuild); // Enter. // Special cases for tutorial progress. if (whatToBuild == "tutorial1") { if (ConversationTrigger.GetToken("done_with_tutorial_2")) { LoadUtils.LoadScene("rocketBoots"); } else if (ConversationTrigger.GetToken("done_with_tutorial_1")) { LoadUtils.LoadScene("tutorial2"); } else { LoadUtils.LoadScene("tutorial1"); } } else // Normal function. { LoadUtils.LoadScene(whatToBuild); } invController.CloseInventory(); }); }
void OnTriggerEnter(Collider other) { if (other.tag == "Player") { Pickup.clip = pickupSound; Pickup.Play(); if (WindChimes != null && PartsSounds != null) { PartsSounds.Stop(); } SimpleData.WriteDataPoint("Pickup_Item", "", "", "", "", pickupName); //if(!levelResetter.hasTaggedFirstPart()) //{ // levelResetter.setTaggedFirstPart(true); // levelResetter.startCountdown(); //} //SimpleData.WriteStringToFile("pickups.txt", Time.time + ",PICKUP," + pickupName); ParticleSystem ps = GetComponent <ParticleSystem>(); ParticleSystem.MainModule psMain = GetComponent <ParticleSystem>().main; switch (type) { case PickupType.Item: // Add the item and update the tokens. InventoryController.Add(this, 1); InventoryController.ConvertInventoryToTokens(); // Poke the build button so it can check if it needs to update. //BuildButton.CheckRecipes(); if (gameObject.tag.Equals("rocketBoots")) { ConversationTrigger.AddToken("picked_up_a_boots_piece"); levelResetter.setWhatToBuild("rocketBoots"); } if (gameObject.tag.Equals("sledgehammer")) { ConversationTrigger.AddToken("picked_up_a_sledge_piece"); levelResetter.setWhatToBuild("sledgehammer"); } if (pickupName.Contains("Key1")) { ConversationTrigger.AddToken("picked_up_a_key1_piece"); } if (pickupName.Contains("FFA")) { ConversationTrigger.AddToken("picked_up_a_ffa_piece"); } // Object still needs to exist for the icon to work. // Silly, but let's just shove it into a corner and forget about it. // Also parents to the scene manager object so it rejects deletion as much as possible. transform.position = new Vector3(-1000f, -1000f, -1000f); //turn aura green and disable pickup trigger if already picked up //this.GetComponent<Collider>().enabled = false; //psMain.startColor = new Color(0f, 255f, 0f, 255f); LoadUtils.IconParenter(this.gameObject); // inc count of item parts and check if done collecting partCounterObj.GetComponent <PartCounter>().incParts(); break; case PickupType.Battery: ConversationTrigger.AddToken("picked_up_a_battery"); // inc count of battery parts and check if done collecting // make sure battery parts UI elements are enabled (won't be for every first battery part pickup) partCounterObj.GetComponent <BatteryCounter>().incParts(); transform.position = new Vector3(-1000f, -1000f, -1000f); //RespawnBattery(); //this.GetComponent<Collider>().enabled = false; //psMain.startColor = new Color(0f, 255f, 0f, 255f); break; case PickupType.Clue: CluePopulator.AddClue(pickupName, clueSprite); ConversationTrigger.AddToken("clue_" + pickupName); ConversationTrigger.AddToken("picked_up_a_clue"); Destroy(gameObject); break; case PickupType.Fuser: transform.position = new Vector3(-1000f, -1000f, -1000f); ConversationTrigger.AddToken("pickedUpFuser"); // gross might have to fix this at some point GameObject.FindWithTag("Player").GetComponent <Fuser>().ActivateFuserFirstLook(); break; } if (autoDelete) { ConversationTrigger.AddToken("autodelete_" + pickupName); } } }
public void incZRots() { SimpleData.WriteDataPoint("Rotate_Object", toRotate.name, "", "", "", "Z"); zRots++; }
// only executes if this gameobject was the first one hit by mouse's raycast // so it won't fire if UI element is clicked and object is behind it, yay public void OnPointerClick(PointerEventData data) { if (!rotationGizmo.controlsDisabled) { Debug.Log("Tutorial Level? " + tutorialLevel); Debug.Log("Rotations remaining: " + rotationCounter.getRotationsRemaining()); // if first time rotating, display Rotation Counter and warning message if (tutorialLevel && rotationCounter.getRotationsRemaining() == 10) { rotationCounter.doIntroRotationsRemaining(); } switch (this.gameObject.name) { case "XUp": rotationGizmo.incXRots(); if (rotationGizmo.limitRotations && !rotationGizmo.isRotating()) { rotationCounter.decrementRotations(); } if (Mathf.Approximately(this.transform.parent.transform.localEulerAngles.y, 180f)) { StartCoroutine(rotationGizmo.Rotate(90f, 0f, 0f)); rotationGizmo.getObjectToRotate().GetComponent <OrientationTracker>().adjustFaceDirections("XDown"); } else { StartCoroutine(rotationGizmo.Rotate(-90f, 0f, 0f)); rotationGizmo.getObjectToRotate().GetComponent <OrientationTracker>().adjustFaceDirections("XUp"); } break; case "XDown": //if (!CheckBattery()) // break; rotationGizmo.incXRots(); if (rotationGizmo.limitRotations && !rotationGizmo.isRotating()) { rotationCounter.decrementRotations(); } if (Mathf.Approximately(this.transform.parent.transform.localEulerAngles.y, 180f)) { StartCoroutine(rotationGizmo.Rotate(-90f, 0f, 0f)); rotationGizmo.getObjectToRotate().GetComponent <OrientationTracker>().adjustFaceDirections("XUp"); } else { StartCoroutine(rotationGizmo.Rotate(90f, 0f, 0f)); rotationGizmo.getObjectToRotate().GetComponent <OrientationTracker>().adjustFaceDirections("XDown"); } break; case "YLeft": // if (!CheckBattery()) // break; rotationGizmo.incYRots(); if (rotationGizmo.limitRotations && !rotationGizmo.isRotating()) { rotationCounter.decrementRotations(); } StartCoroutine(rotationGizmo.Rotate(0f, 90f, 0f)); rotationGizmo.getObjectToRotate().GetComponent <OrientationTracker>().adjustFaceDirections("YRight"); break; case "YRight": // if (!CheckBattery()) // break; rotationGizmo.incYRots(); if (rotationGizmo.limitRotations && !rotationGizmo.isRotating()) { rotationCounter.decrementRotations(); } StartCoroutine(rotationGizmo.Rotate(0f, -90f, 0f)); rotationGizmo.getObjectToRotate().GetComponent <OrientationTracker>().adjustFaceDirections("YLeft"); break; case "ZUp": // if (!CheckBattery()) // break; rotationGizmo.incZRots(); if (rotationGizmo.limitRotations && !rotationGizmo.isRotating()) { rotationCounter.decrementRotations(); } if (Mathf.Approximately(this.transform.parent.transform.localEulerAngles.y, 270f)) { StartCoroutine(rotationGizmo.Rotate(0f, 0f, 90f)); rotationGizmo.getObjectToRotate().GetComponent <OrientationTracker>().adjustFaceDirections("ZLeft"); } else { StartCoroutine(rotationGizmo.Rotate(0f, 0f, -90f)); rotationGizmo.getObjectToRotate().GetComponent <OrientationTracker>().adjustFaceDirections("ZRight"); } break; case "ZDown": // if (!CheckBattery()) // break; rotationGizmo.incZRots(); if (rotationGizmo.limitRotations && !rotationGizmo.isRotating()) { rotationCounter.decrementRotations(); } SimpleData.WriteDataPoint("Rotate_Object", rotationGizmo.getObjectToRotate().name, "", "", "", "Z"); if (Mathf.Approximately(this.transform.parent.transform.localEulerAngles.y, 270f)) { StartCoroutine(rotationGizmo.Rotate(0f, 0f, -90f)); rotationGizmo.getObjectToRotate().GetComponent <OrientationTracker>().adjustFaceDirections("ZRight"); } else { StartCoroutine(rotationGizmo.Rotate(0f, 0f, 90f)); rotationGizmo.getObjectToRotate().GetComponent <OrientationTracker>().adjustFaceDirections("ZLeft"); } break; default: break; } } }