public static void recordParams() { SimpleData.WriteStringToFile("LeapData.txt", "The swipeMinVeloctiy is :" + swipeMinVelocity + "."); SimpleData.WriteStringToFile("LeapData.txt", "The swipeMinDistance is :" + swipeMinDistance + "."); SimpleData.WriteStringToFile("LeapData.txt", "The dragVelocity is :" + dragVelocity + "."); SimpleData.WriteStringToFile("LeapData.txt", "The grabViewFactor is :" + grabViewFactor + "."); SimpleData.WriteStringToFile("LeapData.txt", "The connectTimeLimited is :" + connectTimeLimited + "."); }
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.WriteStringToFile("TimeSpent.txt", Time.time + ",TIMESPENT_INLEVEL," + sceneName + "," + timer); } // If this 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 OnTriggerEnter(Collider other) { if (other.tag == "Player") { AudioSource.PlayClipAtPoint(pickupClip, transform.position); SimpleData.WriteStringToFile("pickups.txt", Time.time + ",PICKUP," + pickupName); switch (type) { case PickupType.Item: // Add the item and update the tokens. InventoryController.Add(this, 1); InventoryController.ConvertInventoryToTokens(); // 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); LoadUtils.IconParenter(this.gameObject); break; case PickupType.Battery: BatterySystem.AddPower(2); BatterySystem.PowerToTokens(); RespawnBattery(); break; case PickupType.Clue: CluePopulator.AddClue(pickupName, clueSprite); ConversationTrigger.AddToken("clue_" + pickupName); Destroy(gameObject); break; } if (autoDelete) { ConversationTrigger.AddToken("autodelete_" + pickupName); } } }
// Use this for initialization void Start() { triggersFinished = new bool[NUM_TRIGGERS]; for (int i = 0; i < NUM_TRIGGERS; i++) { triggersFinished[i] = false; } rotationScript = rotationGizmo.GetComponent <RotationGizmo>(); fuseEvent = eventSystem.GetComponent <FuseEvent>(); selectPart = eventSystem.GetComponent <SelectPart>(); partButtonClicked = false; conversationSystem = GameObject.Find("ConversationSystem"); done = false; //disable part buttons so player can't use them while Dresha talks foreach (Button b in partButtons) { b.interactable = false; } //disable clicking on black regions while Dresha talks //could throw error if any of the objects in attachments do not have a MeshCollider or BoxCollider foreach (GameObject a in attachments) { BoxCollider bcollide = a.GetComponent <BoxCollider>(); if (bcollide == null) { a.GetComponent <MeshCollider>().enabled = false; } else { bcollide.enabled = false; } } SimpleData.WriteStringToFile("LeapData.txt", "***This is another try at " + DateTime.Now.ToString() + "."); LeapStatic.resetConstructionObject("tutorial1"); }
void Start() { invController = transform.parent.parent.parent.GetComponent <InventoryController>(); GetComponent <Button>().onClick.AddListener(() => // Adds an event to the button { //Debug.Log("Recipe Button Pressed: " + myRecipe.recipeName); // Destroy everything on the right. foreach (GameObject jj in recPop.iconsInList) { Destroy(jj); } // Clear the flag list. constructFlags.Clear(); // Actually repopulate. foreach (InvItem jj in myRecipe.components) { // Create the object. GameObject instanceTile = Instantiate(recPop.tileBase); // Set parent and internals. instanceTile.transform.SetParent(recPop.rightPane.transform, false); instanceTile.GetComponentInChildren <Text>().text = InventoryController.GetQuantity(jj.itemName) + " / " + jj.quantity.ToString(); // Find the correct icon from the inventory. if (InventoryController.items.ContainsKey(jj.itemName)) { InventoryPopulator.AddIcon(InventoryController.items[jj.itemName].pickup, instanceTile.transform); } else { instanceTile.GetComponentInChildren <Image>().sprite = questionMark; } // Decide whether to make Construct button selectable. if (InventoryController.GetQuantity(jj.itemName) >= jj.quantity) { constructFlags.Add(true); } else { constructFlags.Add(false); } // Add to object list. recPop.iconsInList.Add(instanceTile); } // Check the flags for each item in the recipe to see if we have all the items. foreach (bool bb in constructFlags) { if (!bb) { recPop.constructButton.interactable = false; break; } else { recPop.constructButton.interactable = true; } } // Remove all other listeners so only the one we add in the next line will work. // This stops several scenes from loading at once, causing terrible things. recPop.constructButton.onClick.RemoveAllListeners(); recPop.constructButton.onClick.AddListener(() => { // Save player info before entering. InventoryController.levelName = SceneManager.GetActiveScene().name; // Close the inventory for safety on updates. //invController.CloseInventory(); // Ensure cursor is active. //Cursor.visible = true; //Cursor.lockState = CursorLockMode.None; // Record data. SimpleData.WriteStringToFile("ModeSwitches.txt", Time.time + ",MODESWITCH_TO," + myRecipe.recipeDesc); // Enter. // Special cases for tutorial progress. if (myRecipe.recipeDesc == "tutorial1") { if (ConversationTrigger.GetToken("done_with_tutorial_2")) { LoadUtils.LoadScene("construction"); } else if (ConversationTrigger.GetToken("done_with_tutorial_1")) { LoadUtils.LoadScene("tutorial2"); } else { LoadUtils.LoadScene("tutorial1"); } } else // Normal function. { LoadUtils.LoadScene(myRecipe.recipeDesc); } invController.CloseInventory(); }); }); }