// Update is called once per frame void Update() { // Set object on sight Ray ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0)); RaycastHit hit; if (Physics.Raycast(ray, out hit, 2.5f)) { Carryable c = hit.collider.gameObject.GetComponent <Carryable> (); if (c != null) { GM.SetObjectOnSight(c); } } else { GM.SetObjectOnSight(null); } // Set object on carry Carryable objectOnSight = GM.GetObjectOnSight(); Carryable objectOnCarry = GM.GetObjectOnCarry(); if (Input.GetMouseButtonDown(0) && !spaceSuit.IsSpaceSuitReadyToWear()) { if (objectOnCarry != null) { objectOnCarry.Release(); GM.SetObjectOnCarry(null); } else if (objectOnSight != null) { objectOnSight.Grab(); GM.SetObjectOnCarry(objectOnSight); } } }
void UpdateHint(string text) { //string text = ""; if (gameState.tutorialRunning) { if (Time.timeSinceLevelLoad > 5f && !gameState.wrenchFound) { text = "Find a wrench in the storage facility.\nStorage is on the bottom of the ship."; } else if (GetObjectOnCarryName() == "Wrench" && IsShipOxygenDeviceBroken()) { text = "Good! Now locate the oxygen generator.\nEngine room is at the back of the ship."; } else if (gameState.wrenchFound && GetObjectOnCarryName() != "Wrench" && IsShipOxygenDeviceBroken()) { text = "Yes, you can drop stuff by clicking again but you're gonna need that wrench."; } else if (GetObjectOnCarryName() == "Wrench" && !IsShipOxygenDeviceBroken()) { text = "Nice job! Click to drop the wrench."; } else if (GetObjectOnCarryName() != "Wrench" && !IsShipOxygenDeviceBroken() && !IsWhaleEventStarted()) { text = "Great! Go check the oxygen status in the cockpit control room. That is on the front of the ship."; } else if (IsWhaleEventStarted()) { text = "Awesome! Now you're good to go by yourself."; } } else { if (gameState.playerNearAirlock) { text = "Press E to open/close airlock."; } else if (IsSpaceSuitOn() && spaceSuit.IsSpaceSuitReadyToWear()) { text = "Click to take off space suit."; } else if (!IsSpaceSuitOn() && spaceSuit.IsSpaceSuitReadyToWear()) { text = "Click to wear space suit."; } else if (GetObjectOnCarryName() != null && !GetObjectOnCarryName().Equals("")) { text = "Click to drop " + GetObjectOnCarryName() + "."; } else if (GetObjectOnSight() != null) { text = "Click to pick up " + GetObjectOnSight().name + "."; } } if (gameState.hintText != text) { gameState.hintText = text; StateChanged(); } }