// gets called when the player presses the interaction button next to a chest public void OpenChest() { // tells the input handler to not run this method until the player finds another chest playerManager.canOpenChest = false; bool rewardIsSippies = (sippyChance >= Random.Range(0f, 1f)); if (rewardIsSippies) { int sippyNum = Random.Range(minSippies, maxSippies); Debug.Log("the number of sippies you got was " + sippyNum); // gives the sippies to the gui code playerStats.AddSippies(sippyNum); } else { bool rewardIsSword = (1f >= Random.Range(0f, 1f)); // TODO implement shields and blocking then change this to (.5f >= ...) if (rewardIsSword) { Debug.Log("you got a sword"); // gives sword to player if they do not have one. upgrades it if they do if (playerInventory.rightWeapon == null) // TODO change to check if it has the unarmed weapon { weaponSlotManager.LoadWeaponOnSlot(rightHandWeapons, false); } else { // TODO upgrade held sword } } else { Debug.Log("you got a shield"); // gives shield to player if they do not have one. upgrades it if they do if (playerInventory.leftWeapon == null) // TODO change to check if it has the unarmed weapon { weaponSlotManager.LoadWeaponOnSlot(leftHandWeapons, true); } else { // TODO upgrade held shield } } } // replaces chest with open chest that doesn't have the chest tag Vector3 newChestPosition = currentChest.transform.position; Quaternion newChestRotation = currentChest.transform.rotation; Destroy(currentChest); Instantiate(openedChest, newChestPosition, newChestRotation); // resets currentChest currentChest = gameObject; }
// puts the predetermines weapons in the player's hand, if there are any private void Start() { weaponSlotManager.LoadWeaponOnSlot(rightWeapon, false); weaponSlotManager.LoadWeaponOnSlot(leftWeapon, true); }