public void Hit(float points) { if (hitPoints - points > 0) { if (GodMode) { if (infoMessage != null) { infoMessage.DisplayMessage("GOD MODE", 2F); } } else { hitPoints -= points; if (infoMessage != null) { infoMessage.DisplayMessage("YOU ARE HIT! RUN YOU FOOLS", 2F); } if (gameManager != null) { gameManager.TakeDamage(points); } if (activeVolume != null) { if (vignette != null) { vignette.color.value = new Color(50, 0, 0, 255); vignette.intensity.value = 0.02F; StartCoroutine(ResetVignette()); } } } } else if (!isDead) { isDead = true; if (infoMessage != null) { infoMessage.DisplayMessage("YOU ARE DEAD", 100, true); } Debug.Log("DEAD"); if (activeVolume != null) { activeVolume.profile.TryGetSettings(out vignette); if (vignette != null) { vignette.intensity.value = 100F; } } // Game Over, load gameoverscene SceneManager.LoadScene("GameOverScene"); } }
public void OpenMenu(InventorySlot inventorySlot) { if (inventorySlot != null) { if (inventorySlot.inventoryGroup != null && inventorySlot.inventoryGroup.InventoryItem != InventoryItem.Hammer) { if (inventorySlot.inventoryGroup.Amount > 0) { itemToGive = inventorySlot; familyScreen.GetComponent <Canvas>().enabled = true; } else { infoMessage.DisplayMessage("You do not have this resource", 2F); } } if (inventorySlot.inventoryGroup != null && inventorySlot.inventoryGroup.InventoryItem == InventoryItem.Hammer) { infoMessage.DisplayMessage("Hammers for the bridge...", 2F); } } else { infoMessage.DisplayMessage("Pick something up first!", 2F); } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Player") { isInRange = true; player = other.transform.gameObject; if (!player.GetComponent <Interactor>().CanFixBridge) { infoMessage.DisplayMessage("You need a hammer", 1.5F); } else { infoMessage.DisplayMessage("E to build the bridge", 1.5F, true); } } }
private IEnumerator DetectPlayer() { for (; ; ) { // Cast a sphere wrapping character controller 10 meters forward // to see if it is about to hit anything. int layerMask = LayerMask.GetMask("Player"); Vector3 lowerPos = transform.position; lowerPos.y -= 2F; if (Physics.SphereCast(lowerPos, 0.75F, transform.up, out RaycastHit hit, 2F, layerMask, QueryTriggerInteraction.Ignore)) { isInRange = true; player = hit.transform.gameObject; if (sendInfo) { if (infoMessage.CurrentMessage != "Pick up with E") { infoMessage.DisplayMessage("Pick up with E", 1F); sendInfo = false; StartCoroutine(MessageCoolOff()); } } }
IEnumerator NotifyAboutTasks() { for (; ;) { if (currentTask == -1) { currentTask = 0; } if (currentTask == 0 && interactor.CanFixBridge) { currentTask = 1; } if (currentTask == 1 && Interactor.BridgeFixed) { currentTask = 2; } if (currentTask == 2 && interactor.AreBerriesCollected) { currentTask = 3; } if (currentTask == 3 && Interactor.ProvidedForFamilyBerries) { currentTask = 4; } if (currentTask == 4 && interactor.ChestsLocated) { currentTask = 5; } if (currentTask == 5 && Interactor.ProvidedForFamilyGold) { try { GameObject go = GameObject.FindGameObjectsWithTag("Lost").FirstOrDefault(x => x.name == "LostFamily"); foreach (Transform t in go.transform) { t.gameObject.SetActive(true); } } catch { Interactor.FindTheFamilyMember = true; } currentTask = 6; } if (currentTask == 6 && Interactor.FindTheFamilyMember) { currentTask = 7; infoMessage.DisplayMessage("Current Task: " + playerTasks[currentTask].TaskName + " : " + playerTasks[currentTask].Message, 200F, true); try { GameObject animalContainer = GameObject.FindGameObjectWithTag("AnimalContainer"); Vector3 pos = animalContainer.transform.position; pos.x += 0.06F; Instantiate(animalContainer, pos, animalContainer.transform.rotation); StartInfoCanvas.allowGod = true; Player.GodMode = true; infoMessage.DisplayMessage(@"YOU FOUND ME! LOVE YOU!!! HAVE GOD MODE AS A GIFT (hit 'TAB' to enable)", 45F, true); StartCoroutine(SlowTime()); } catch (Exception ex) { infoMessage.DisplayMessage("FAILED TO CREATED ALL THE ENEMIES", 10F, true); Debug.Log(ex.Message); } infoMessage.SetIsFinished(true); break; } else { infoMessage.DisplayMessage("Current Task: " + playerTasks[currentTask].TaskName + " : " + playerTasks[currentTask].Message, 5F, false); yield return(new WaitForSeconds(2F)); } StartInfoCanvas.currentTask = playerTasks[currentTask].TaskName + " : " + playerTasks[currentTask].Message; } }
private void Message(string v) { infoMessage.DisplayMessage(v, 2F, false); }