void OnTriggerStay(Collider coll) { if (coll.tag == "Tree") { if (inventory.reusableObject == reusableObjects.hatchet) { string[] toBePassed = { "MUO1" }; EventManager.StringEvent(toBePassed); CurrTree = coll.gameObject; } } switch (coll.tag) { case "Water": movement.speedMult = .5f; onSpace = inWater; break; case "Bush": Hide(); break; case "Cave": Hide(); break; } }
void OnTriggerExit(Collider coll) { switch (coll.tag) { case "Tree": if (inventory.reusableObject == reusableObjects.hatchet) { string[] toBePassed = { "MUO0" }; EventManager.StringEvent(toBePassed); CurrTree = null; } break; case "Water": UnHide(); onSpace = sprint; string[] Mess = { string.Format(WaterDropMess_ONLY) }; EventManager.StringEvent(Mess); break; case "Bush": UnHide(); break; case "Cave": UnHide(); break; } }
void Start() { feedback.initialColor = feedback.initialColor == null ? Color.white : feedback.initialColor; feedback.secondaryColor = feedback.secondaryColor == null ? Color.red : feedback.secondaryColor; thrownItem.bullet = thrownItem.bullet ?? new GameObject(); Keys.Add("Up", (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Up", "W"))); Keys.Add("Down", (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Down", "S"))); Keys.Add("Left", (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Left", "A"))); Keys.Add("Right", (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Right", "D"))); Keys.Add("Sprint", (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Sprint", "Space"))); Keys.Add("Reusable", (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Reusable", "E"))); Keys.Add("Consumable", (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Consumable", "R"))); inventory.hasKey = false; inventory.singleUseObject = singleUseObjects.none; EventManager.PassStrings += ParseStrings; onSpace = sprint; Stamina.Stamina += 100f; Health += 100f; if (PlayerPrefs.HasKey("FileToLoadFrom")) { int file = PlayerPrefs.GetInt("FileToLoadFrom"); string[] toBePassed = { string.Format("Load{0}", file) }; PlayerPrefs.DeleteKey("FileToLoadFrom"); EventManager.StringEvent(toBePassed); } if (PlayerPrefs.HasKey("PlayerSUO")) { int SUO = PlayerPrefs.GetInt("PlayerSUO"); switch (SUO) { case 1: { SetSingleUse(singleUseObjects.pebble); break; } case 2: { SetSingleUse(singleUseObjects.healthkit); break; } } PlayerPrefs.DeleteKey("PlayerSUO"); } PlayerPrefs.Save(); }