// Use this for initialization void Start() { GameController.OnMouseLeftClickGameObject += InteractWithOlChap; _soundPlayer = GetComponent <SoundPlayer>(); _olChapBehaviour = this; }
public void PickUp(GameObject go) { if (this.gameObject != go) { return; } if (!_playerInventory.IsFull()) { Item itemCopy = _item; _playerInventory.AddItem(itemCopy); GameController.errorMessage.AddMessage(string.Format("Picked up {0}", itemCopy.Name, Color.white)); if (OlChapBehaviour.GetQuestProgression() == 2) { OlChapBehaviour.ContinuePorgression(); ObjectiveText.SetObjectiveText("- Go back to the old man"); } Destroy(this.gameObject); Destroy(_textScript.gameObject); } else { transform.parent.position = this.transform.position; _itemFlipAnimation.Play(); GameController.errorMessage.AddMessage("Inventory is full!"); } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Player") { if (OlChapBehaviour.GetQuestProgression() == 1) { OlChapBehaviour.ContinuePorgression(); ObjectiveText.SetObjectiveText("- Go back to the old man"); Destroy(this.gameObject); } } }
private void InteractWithDoor(GameObject gameObject) { if (gameObject == this.gameObject) { if (OlChapBehaviour.GetQuestProgression() >= 7) { GameController.mainCanvas.FadeToBlack(); OlChapBehaviour.ContinuePorgression(); GameObject.Find("villageElder").GetComponent <OlChapBehaviour>().DisplayQuestObjective(); GameObject.Find("villageElder").GetComponent <AudioSource>().spatialBlend = 0; GetComponent <AudioSource>().Play(); } } }
private void OpenShop(GameObject go) { if (this.gameObject != go) { return; } SetAllWindowsActive(); if (OlChapBehaviour.GetQuestProgression() == 3) { OlChapBehaviour.ContinuePorgression(); ObjectiveText.SetObjectiveText("- Return to the old man"); } }
//Death animation private void PlayDyingAnimation() { if (!_animator.GetBool("isDying")) { //Play death animation here lmao if (!_isMeleeEnemy && OlChapBehaviour.GetQuestProgression() == 4) { OlChapBehaviour.ContinuePorgression(); ObjectiveText.SetObjectiveText("- Go back to the old man"); } SetAnimationState(AnimationState.Dying); GetComponent <Collider>().enabled = false; GetComponent <DropLoot>().DropItems(this.transform); } }
private void OpenChest(GameObject go) { if (this.gameObject != go) { return; } if (!_openChestAnimation.GetBool("isClicked")) { GetComponent <DropLoot>().DropItems(this.transform); _openChestAnimation.SetBool("isClicked", true); if (OlChapBehaviour.GetQuestProgression() == 5) { OlChapBehaviour.ContinuePorgression(); ObjectiveText.SetObjectiveText("- Go back to the old man"); } } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Player") { GameController.questProgress++; if (GameController.questProgress >= 5) { OlChapBehaviour.ContinuePorgression(); ObjectiveText.SetObjectiveText("- Go back to the old man"); } else { ObjectiveText.SetObjectiveText("- Find keys (" + GameController.questProgress + "/5)"); } GetComponent <Collider>().enabled = false; GetComponent <Renderer>().enabled = false; GetComponent <AudioSource>().Play(); } }
private void TeleportPlayer() { if (Input.GetMouseButtonDown(0) && OlChapBehaviour.GetQuestProgression() > 1) { RaycastHit raycastHit = new RaycastHit(); Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out raycastHit); if (raycastHit.transform.gameObject == this.gameObject) { if (GoToHubPortal) { GameController.GoToHub(); } else { switch (OlChapBehaviour.GetQuestProgression()) { case 2: ObjectiveText.SetObjectiveText("- Kill and enemy and find an item"); break; case 4: ObjectiveText.SetObjectiveText("- Kill a radish"); break; case 5: ObjectiveText.SetObjectiveText("- Find and loot a chest"); break; case 6: ObjectiveText.SetObjectiveText("- Find keys (" + GameController.questProgress + "/5)"); break; } GameController.GoToLevel(); } } } }