// Update is called once per frame void Update() { float distance = Vector3.Distance(transform.position, TestCharController.player.transform.position); //print(distance); if (distance < .25 && !textMade) { if (GameController.xbox360Enabled()) { interactText = Instantiate(Resources.Load("Prefabs/Interact_XBox"), new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity) as GameObject; } else { interactText = Instantiate(interactTextPrefab, new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity); } textMade = true; } else if (distance >= .25) { Destroy(interactText); textMade = false; } if (distance < .25 && InputManager.A_Button()) { StartCoroutine(DoorRoutine()); } }
// Update is called once per frame void Update() { float distance = Vector3.Distance(holder2.transform.position, TestCharController.player.transform.position); //print(distance); if (distance < .5 && !textMade) { if (GameController.xbox360Enabled()) { interactText = Instantiate(Resources.Load("Prefabs/Interact_XBox") as GameObject, new Vector2(holder2.transform.position.x + .35f, holder2.transform.position.y + .15f), Quaternion.identity); } else { interactText = Instantiate(Resources.Load("Prefabs/Interact") as GameObject, new Vector2(holder2.transform.position.x + .35f, holder2.transform.position.y + .15f), Quaternion.identity); } textMade = true; } else if (distance >= .5) { Destroy(interactText); textMade = false; } CheckFruit(); //If interact is pressed if (distance < .5 && (InputManager.A_Button() || Input.GetKeyDown(KeyCode.F))) { PlaceFruit(); } }
// Update is called once per frame void Update() { float distance = Vector2.Distance(new Vector2(transform.localPosition.x, transform.localPosition.y), TestCharController.player.transform.position); //print(distance); if (distance < .35 && !textMade) { if (GameController.xbox360Enabled()) { interactText = Instantiate(Resources.Load("Prefabs/Interact_XBox"), new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity) as GameObject; } else { interactText = Instantiate(interactPrefab, new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity); } textMade = true; } else if (distance >= .35) { Destroy(interactText); textMade = false; } //Activate the hero soul else if (InputManager.A_Button() && !inbuffer) { Destroy(interactText); StartCoroutine(OpenBuffer()); } }
// Update is called once per frame void Update() { float distance = Vector2.Distance(new Vector2(transform.localPosition.x, transform.localPosition.y), TestCharController.player.transform.position); //print(distance); if (distance < .5 && !textMade) { if (GameController.xbox360Enabled()) { interactText = Instantiate(Resources.Load("Prefabs/Interact_XBox"), new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity) as GameObject; } else { interactText = Instantiate(interactPrefab, new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity); } textMade = true; } else if (distance >= .5) { Destroy(interactText); textMade = false; } if (distance < .5 && (Input.GetKeyDown(KeyCode.F) || InputManager.A_Button()) && !TestCharController.inDialogue) { StartCoroutine(TalkRoutine()); } }
public void SelectEntry() { if (InputManager.A_Button()) { //print(EventSystem.current.currentSelectedGameObject.GetComponent<Bestiary_Slab>().monsterID); GameObject.Find("GenNoise").GetComponent <AudioSource>().Play(); int index = selectIndex; if (Bestiary_Database.monsterDB[index].discovered) { beastPage.SetActive(true); background.sprite = Resources.Load <Sprite>("Bestiary/" + Bestiary_Database.monsterDB[index].background); foreground.sprite = Resources.Load <Sprite>("Bestiary/" + Bestiary_Database.monsterDB[index].foreground); monsterSprite.sprite = Resources.Load <Sprite>("Bestiary/Enemies/" + Bestiary_Database.monsterDB[index].monsterSprite); monsterName.text = Bestiary_Database.monsterDB[index].monsterName; monsterHealth.text = "<color=yellow>Health: </color>" + Bestiary_Database.monsterDB[index].monsterHealth; monsterWeak.text = "<color=yellow>Weakness: </color>" + Bestiary_Database.monsterDB[index].monsterWeakness; monsterDrops.text = "<color=yellow>Item Drops:</color>\n" + Bestiary_Database.monsterDB[index].monsterDrop; monsterArcana.text = "<color=yellow>Arcana Drops:</color>\n" + Bestiary_Database.monsterDB[index].monsterArcana; monsterDesc.text = Bestiary_Database.monsterDB[index].monsterDesc; } else { CloseMonsterPage(); } } }
// Update is called once per frame void Update() { float distance = Vector3.Distance(transform.position, TestCharController.player.transform.position); //print(distance); if (distance < .35 && !textMade && !GetComponentInParent <Rune_Puzzle>().cleared) { if (GameController.xbox360Enabled()) { interactText = Instantiate(Resources.Load("Prefabs/Interact_XBox") as GameObject, new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity); } else { interactText = Instantiate(Resources.Load("Prefabs/Interact") as GameObject, new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity); } textMade = true; } else if (distance >= .35) { Destroy(interactText); textMade = false; } //If interact is pressed if (distance < .5 && (InputManager.A_Button() || Input.GetKeyDown(KeyCode.F)) && !GetComponentInParent <Rune_Puzzle>().cleared) { //GameObject.Find("GenNoise").GetComponent<AudioSource>().Play(); ActivateRune(); } }
// Update is called once per frame void Update() { float distance = Vector3.Distance(transform.position, player.transform.position); //print(distance); if (distance < .35 && !textMade) { if (GameController.xbox360Enabled()) { interactText = Instantiate(Resources.Load("Prefabs/Interact_XBox") as GameObject, new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity); } else { interactText = Instantiate(Resources.Load("Prefabs/Interact") as GameObject, new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity); } textMade = true; } else if (distance >= .35) { Destroy(interactText); textMade = false; } //If interact is pressed if (distance < .35 && (InputManager.A_Button() || Input.GetKeyDown(KeyCode.F))) { GetComponent <AudioSource>().Play(); Destroy(interactText); spearBox.SetActive(false); StartCoroutine(SpearTalk()); } }
public void DisplayQuest() { if (InputManager.A_Button() && (questMainList.Count > 0 || questSideList.Count > 0)) { GameObject.Find("GenNoise").GetComponent <AudioSource>().Play(); displayQuest = selectIndex + 1; if (!mainQuest) { displayQuest += 3; } SetDisplay(); } }
//Gamepad Controls public void DecipherCard() { if (InputManager.A_Button() && !LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].isOpened && !cardDiscover) { buttonNoise.Play(); decipherButton.Play("DecipherButtonClick"); arcanaCard[0].Play("Arcana_Card_Fade"); arcanaCard[1].Play("Arcana_Card_Fade"); arcanaCard[2].Play("Arcana_Card_Fade"); StartCoroutine(CardDiscoverRoutine()); LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].isOpened = true; } }
// Update is called once per frame void Update() { //check distance of book pedestal to the player bookDistance = Vector3.Distance(transform.position, TestCharController.player.transform.position); if (bookDistance < .35 && !textMade) { if (GameController.xbox360Enabled()) { interactText = Instantiate(Resources.Load("Prefabs/Interact_XBox"), new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity) as GameObject; } else if (!GameController.xbox360Enabled()) { print("DS"); interactText = Instantiate(interactPrefab, new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity); } textMade = true; } else if (bookDistance > .35) { Destroy(interactText); bookPanel.SetActive(false); panelOpen = false; helpPanel.SetActive(false); textMade = false; } //Interaction actions if (bookDistance < .35 && InputManager.A_Button() && !panelOpen) { Destroy(interactText); bookPanel.SetActive(true); panelOpen = true; helpPanel.SetActive(true); TestCharController.inDialogue = true; } else if (bookDistance < .35 && (InputManager.B_Button() || Input.GetKeyDown(KeyCode.F)) && panelOpen) { Destroy(interactText); bookPanel.SetActive(false); panelOpen = false; helpPanel.SetActive(false); StartCoroutine(CloseRoutine()); } }
// Update is called once per frame void Update() { float distance = Vector2.Distance(new Vector2(transform.localPosition.x, transform.localPosition.y), TestCharController.player.transform.position); //print(distance); if (distance < .5 && !textMade) { if (GameController.xbox360Enabled()) { interactText = Instantiate(Resources.Load("Prefabs/Interact_XBox"), new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity) as GameObject; } else { interactText = Instantiate(interactPrefab, new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity); } textMade = true; } else if (distance >= .5) { Destroy(interactText); textMade = false; } if (distance < .5 && InputManager.A_Button() && !TestCharController.inDialogue) { bool magicQuest = false; //Check if the magic quest is still active for (int i = 0; i < QuestManager.activeMainQuests.Count; i++) { if (QuestManager.activeMainQuests[i].questName == "It's Magic") { magicQuest = true; break; } } if (!magicQuest) { StartCoroutine(ShopRoutine()); } else { StartCoroutine(CeciliaTalkRoutine()); } } }
public void SelectCard() { if (LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].isOpened) { if (InputManager.A_Button()) { GameObject.Find("GenNoise").GetComponent <AudioSource>().Play(); if (arcanaCard[selectIndex].transform.Find("Font_Card_IMG").GetComponent <Arcana_Book_Select>().cardName != "" && LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].pickedCardIndex == -1) { LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].pickedCardIndex = selectIndex; InventoryManager.playerSpellbook[LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].fontCard[selectIndex].cardID] = true; LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].fontCard[selectIndex].cardQuant++; UpdateCards(); } } } }
// Update is called once per frame void Update() { if (InputManager.R_Bumper()) { Add(); } else if (InputManager.L_Bumper()) { Sub(); } else if (InputManager.A_Button()) { Purchase(); } else if (InputManager.B_Button()) { Back(); } }
// Update is called once per frame void Update() { float distance = Vector2.Distance(new Vector2(transform.localPosition.x, transform.localPosition.y), TestCharController.player.transform.position); //print(distance); if (distance < .5 && !textMade) { if (GameController.xbox360Enabled()) { interactText = Instantiate(Resources.Load("Prefabs/Interact_XBox") as GameObject, new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity); } else { interactText = Instantiate(interactPrefab, new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity); } textMade = true; } else if (distance >= .5) { Destroy(interactText); textMade = false; } if (distance < .5 && InputManager.A_Button() && !TestCharController.inDialogue && !InventoryController.inInv) { GetComponent <Shop_Database>().initDB(); TestCharController.inDialogue = true; //Read the special Items Shop_Database.saleList[3] = LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].specialShopInv; /* * for(int i = 0; i < LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].specialShopInv.Count; i++) * { * print(LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].specialShopInv[i] + " "); * } */ Shop_Controller.shopIndex = 3; shopHud.SetActive(true); GameObject.Find("ShopController").GetComponent <Shop_Controller>().UpdateShop(); } }
void Update() { if (isDone) { loadText.gameObject.GetComponent <LoadText>().isDone = true; if (GameController.xbox360Enabled()) { loadText.text = "Press A to Continue."; } else { loadText.text = "Press Space to Continue."; } if (Input.GetKey(KeyCode.Space) || InputManager.A_Button()) { ao.allowSceneActivation = true; } } }
// Update is called once per frame void Update() { float distance = Vector3.Distance(transform.position, player.transform.position); //print(distance); if (distance < .35 && !textMade) { interactText = Instantiate(Resources.Load("Prefabs/QuestionBubble") as GameObject, TestCharController.player.Find("Player_States_Panel").transform); textMade = true; } else if (distance >= .35) { Destroy(interactText); textMade = false; } //If interact is pressed if (distance < .35 && (InputManager.A_Button() || Input.GetKeyDown(KeyCode.F)) && !active && !TestCharController.inDialogue) { GameObject.Find("GenNoise").GetComponent <AudioSource>().Play(); StartCoroutine(CatTalk()); } }
public void TakeItem() { if (InputManager.A_Button() && !padActive) { GameObject.Find("GenNoise").GetComponent <AudioSource>().Play(); //check to see if item is in player inv for (int j = 0; j < InventoryManager.playerInventory.Length; j++) { if (LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].treasureInv[selectedIndex].itemID == InventoryManager.playerInventory[j].itemID) { //Check if item is stackable if (LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].treasureInv[selectedIndex].stackable) { //Add the treasure item stack to the player item stack InventoryManager.playerInventory[j].itemQuantity += LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].treasureInv[selectedIndex].itemQuantity; //Remove item from treasure inv LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].treasureInv[selectedIndex] = GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[0]; } } //If item not found or is not stackable put it in an empty slot else { for (int k = 0; k < InventoryManager.playerInventory.Length; k++) { if (InventoryManager.playerInventory[k].itemID == 0 || InventoryManager.playerInventory[k] == null) { InventoryManager.playerInventory[k] = LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].treasureInv[selectedIndex]; LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].treasureInv[selectedIndex] = GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[0]; } } } } UpdateTreasureInv(); GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); } }
// Update is called once per frame void Update() { if (GameController.xbox360Enabled()) { if (InputManager.MainVertical() < 0 && !active) { active = true; padY++; if (padY > choice.Count - 1) { padY = 0; } UpdateCursor(); StartCoroutine(padBuffer()); } else if (InputManager.MainVertical() > 0 && !active) { active = true; padY--; if (padY < 0) { padY = choice.Count - 1; } UpdateCursor(); StartCoroutine(padBuffer()); } if (InputManager.A_Button()) { //GameObject.Find("GenNoise").GetComponent<AudioSource>().Play(); active = false; var pointer = new PointerEventData(EventSystem.current); ExecuteEvents.Execute(choice[padY].gameObject, pointer, ExecuteEvents.pointerClickHandler); } } }
// Update is called once per frame void Update() { //Checks if the player wants to skip dialogue if (((Input.GetMouseButtonDown(0)) || InputManager.A_Button()) && !dialogueSkip && !dialogueWait) { dialogueSkip = true; } //Skip Entire Dialogue if ((Input.GetKeyDown(KeyCode.Space) || InputManager.B_Button()) && !waitingDecision && !noSkip) { skipDialogue = true; } if (Input.GetMouseButton(1)) { speedFactor = 0.25f; } else { speedFactor = 1; } }
// Update is called once per frame void Update() { if (GameController.xbox360Enabled()) { UpdateCursor(); if (InputManager.A_Button() && active && index == -1) { GetComponent <Animator>().Play("Title_Cover_Wipe"); GetComponent <AudioSource>().Play(); anyKey.SetActive(false); StartCoroutine(ShowMenu()); active = false; } else if (InputManager.A_Button() && !active && index > -1) { switch (index) { default: break; case 0: PlayGame(); break; case 1: QuitGame(); break; } } if (InputManager.MainVertical() > 0 && !cursorBuffer) { index--; if (index < 0) { index = 1; } cursorBuffer = true; cursorMenu.GetComponent <AudioSource>().Play(); StartCoroutine(CursorBuffer()); } else if (InputManager.MainVertical() < 0 && !cursorBuffer) { index++; if (index > 1) { index = 0; } cursorBuffer = true; cursorMenu.GetComponent <AudioSource>().Play(); StartCoroutine(CursorBuffer()); } } else { if (Input.anyKeyDown && active) { GetComponent <Animator>().Play("Title_Cover_Wipe"); GetComponent <AudioSource>().Play(); anyKey.SetActive(false); StartCoroutine(ShowMenu()); active = false; } } }
void SelectItem() { if (InputManager.A_Button()) { //Inventory 1st State Item, Open Inv menu if (!invHUDMade && selectTab == 0 && InventoryManager.playerInventory[selectedIndex].itemID != 0) { GameObject.Find("GenNoise").GetComponent <AudioSource>().Play(); //Inv Menu made state invHUDMade = true; MakeInvHUD(); invHUDselection = 0; } //Inventory 2nd State Item, Select Inv menu else if (invHUDMade && selectTab == 0) { if (invHUDselection == 0) { invMenu.GetComponent <InvMenu>().PadEquip(); invMenu.GetComponent <InvMenu>().PadInspect(); } else if (invHUDselection == 1) { invMenu.GetComponent <InvMenu>().PadSplit(); //StartCoroutine(DestroyHUD()); } else if (invHUDselection == 2) { invMenu.GetComponent <InvMenu>().PadDestroy(); //StartCoroutine(DestroyHUD()); } invHUDMade = false; } else if (!invHUDMade && selectTab == 1 && InventoryManager.playerEquipment[selectedIndex].itemID != 0) { //Check if there is a empty space in the inv bool spaceFound = false; for (int i = 0; i < InventoryManager.playerEquipment.Length; i++) { if (InventoryManager.playerInventory[i].itemID == 0) { GameObject.Find("GenNoise").GetComponent <AudioSource>().Play(); spaceFound = true; InventoryManager.playerInventory[i] = InventoryManager.playerEquipment[selectedIndex]; InventoryManager.playerEquipment[selectedIndex] = GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[0]; break; } } if (!spaceFound) { GameObject.Find("ErrorNoise").GetComponent <AudioSource>().Play(); } UpdateEquip(); UpdateInventory(); } } if (InputManager.B_Button() && invHUDMade) { GameObject.Find("GenNoise").GetComponent <AudioSource>().Play(); StartCoroutine(DestroyHUD()); } else if (InputManager.MainVertical() < -.5f && invHUDMade && !padActive) { GameObject.Find("GenNoise").GetComponent <AudioSource>().Play(); padActive = true; invHUDselection++; if (invHUDselection > 2) { invHUDselection = 0; } StartCoroutine(PadBuffer()); } else if (InputManager.MainVertical() > .5f && invHUDMade && !padActive) { GameObject.Find("GenNoise").GetComponent <AudioSource>().Play(); padActive = true; invHUDselection--; if (invHUDselection < 0) { invHUDselection = 2; } StartCoroutine(PadBuffer()); } if (invHUDMade) { Destroy(invHUDSlot); invHUDSlot = Instantiate(Resources.Load("Prefabs/Inventory/Inv_Select"), invMenu.transform) as GameObject; switch (invHUDselection) { default: break; case 0: Instantiate(Resources.Load("Prefabs/Inventory/Inv_Cursor"), invHUDSlot.transform.Find("Option_1").transform); break; case 1: Instantiate(Resources.Load("Prefabs/Inventory/Inv_Cursor"), invHUDSlot.transform.Find("Option_2").transform); break; case 2: Instantiate(Resources.Load("Prefabs/Inventory/Inv_Cursor"), invHUDSlot.transform.Find("Option_3").transform); break; } } }
// Update is called once per frame void Update() { Vector3 worldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition); worldPoint.z = Camera.main.transform.position.z; Ray ray = new Ray(worldPoint, new Vector3(0, 0, 1)); RaycastHit2D hit = Physics2D.GetRayIntersection(ray, 100, 1 << 8); //if(hit.collider != null) //print(hit.collider.name); //Check if item can be used if (hit.collider != null && hit.collider.tag == "Inv_Menu_Use" && !inMenu) { choiceHover = true; useText.color = new Color(255, 255, 0); splitText.color = new Color(255, 255, 255); destroyText.color = new Color(255, 255, 255); if (optionID == 1 && Input.GetMouseButtonDown(0)) { InventoryController.equip.SetActive(true); InventoryController.equipToggle = true; noise.Play(); switch (itemType) { default: break; case "Weapon": //Check if there is a weapon equipped if (InventoryManager.playerEquipment[0].itemID == 0) { InventoryManager.playerEquipment[0] = InventoryManager.playerInventory[slotNumber]; InventoryManager.playerInventory[slotNumber] = GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[0]; GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateEquip(); } else if (InventoryManager.playerEquipment[0].itemID != 0) { Item tempItem = InventoryManager.playerEquipment[0]; InventoryManager.playerEquipment[0] = InventoryManager.playerInventory[slotNumber]; InventoryManager.playerInventory[slotNumber] = tempItem; GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateEquip(); } break; case "Head": //Check if there is a head equipped if (InventoryManager.playerEquipment[1].itemID == 0) { InventoryManager.playerEquipment[1] = InventoryManager.playerInventory[slotNumber]; InventoryManager.playerInventory[slotNumber] = GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[0]; GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateEquip(); } else if (InventoryManager.playerEquipment[1].itemID != 0) { Item tempItem = InventoryManager.playerEquipment[1]; InventoryManager.playerEquipment[1] = InventoryManager.playerInventory[slotNumber]; InventoryManager.playerInventory[slotNumber] = tempItem; GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateEquip(); } break; case "Neck": //Check if there is a neck equipped if (InventoryManager.playerEquipment[2].itemID == 0) { InventoryManager.playerEquipment[2] = InventoryManager.playerInventory[slotNumber]; InventoryManager.playerInventory[slotNumber] = GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[0]; GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateEquip(); } else if (InventoryManager.playerEquipment[2].itemID != 0) { Item tempItem = InventoryManager.playerEquipment[2]; InventoryManager.playerEquipment[2] = InventoryManager.playerInventory[slotNumber]; InventoryManager.playerInventory[slotNumber] = tempItem; GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateEquip(); } break; case "Body": //Check if there is a body equipped if (InventoryManager.playerEquipment[3].itemID == 0) { InventoryManager.playerEquipment[3] = InventoryManager.playerInventory[slotNumber]; InventoryManager.playerInventory[slotNumber] = GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[0]; GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateEquip(); } else if (InventoryManager.playerEquipment[3].itemID != 0) { Item tempItem = InventoryManager.playerEquipment[3]; InventoryManager.playerEquipment[3] = InventoryManager.playerInventory[slotNumber]; InventoryManager.playerInventory[slotNumber] = tempItem; GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateEquip(); } break; case "Feet": //Check if there is a feet equipped if (InventoryManager.playerEquipment[5].itemID == 0) { InventoryManager.playerEquipment[5] = InventoryManager.playerInventory[slotNumber]; InventoryManager.playerInventory[slotNumber] = GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[0]; GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateEquip(); } else if (InventoryManager.playerEquipment[5].itemID != 0) { Item tempItem = InventoryManager.playerEquipment[5]; InventoryManager.playerEquipment[5] = InventoryManager.playerInventory[slotNumber]; InventoryManager.playerInventory[slotNumber] = tempItem; GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateEquip(); } break; case "Ring": //Check if there is a ring equipped if (InventoryManager.playerEquipment[4].itemID == 0) { InventoryManager.playerEquipment[4] = InventoryManager.playerInventory[slotNumber]; InventoryManager.playerInventory[slotNumber] = GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[0]; GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateEquip(); } else if (InventoryManager.playerEquipment[6].itemID == 0) { InventoryManager.playerEquipment[6] = InventoryManager.playerInventory[slotNumber]; InventoryManager.playerInventory[slotNumber] = GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[0]; GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateEquip(); } else if (InventoryManager.playerEquipment[4].itemID != 0) { Item tempItem = InventoryManager.playerEquipment[4]; InventoryManager.playerEquipment[4] = InventoryManager.playerInventory[slotNumber]; InventoryManager.playerInventory[slotNumber] = tempItem; GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateEquip(); } break; } gameObject.SetActive(false); InventoryController.invMenuToggle = false; } //Use else if (optionID == 2) { choiceHover = true; noise.Play(); } //Inspect else if (optionID == 3 && Input.GetMouseButtonDown(0) && !inMenu) { choiceHover = true; noise.Play(); //Spear if (itemID == 79) { InventoryManager.playerInventory[slotNumber] = GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[0]; GameObject.Find("InventoryController").GetComponent <ItemDatabase>().IdentifySpear(slotNumber); gameObject.SetActive(false); InventoryController.invMenuToggle = false; } //Neck if (itemID == 80) { InventoryManager.playerInventory[slotNumber] = GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[0]; GameObject.Find("InventoryController").GetComponent <ItemDatabase>().IdentifyNeck(slotNumber); gameObject.SetActive(false); InventoryController.invMenuToggle = false; } //Ring if (itemID == 81) { InventoryManager.playerInventory[slotNumber] = GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[0]; GameObject.Find("InventoryController").GetComponent <ItemDatabase>().IdentifyRing(slotNumber); gameObject.SetActive(false); InventoryController.invMenuToggle = false; } } } //Check if item can be split else if (hit.collider != null && hit.collider.tag == "Inv_Menu_Split" && !inMenu) { choiceHover = true; splitText.color = new Color(255, 255, 0); useText.color = new Color(255, 255, 255); destroyText.color = new Color(255, 255, 255); if (Input.GetMouseButtonDown(0) && InventoryManager.playerInventory[slotNumber].itemQuantity > 1 && InventoryManager.playerInventory[slotNumber].stackable) { noise.Play(); numSplit = 1; splitTextNum.text = numSplit.ToString(); splitPanel.SetActive(true); inMenu = true; } else if (Input.GetMouseButtonDown(0) && (InventoryManager.playerInventory[slotNumber].itemQuantity <= 1 || !InventoryManager.playerInventory[slotNumber].stackable)) { error.Play(); } } else if (hit.collider != null && hit.collider.tag == "Split_Item_Yes" && inMenu) { if (Input.GetMouseButtonDown(0)) { bool itemFound = false; //check for an empty inv slot for (int i = 0; i < InventoryManager.playerInventory.Length; i++) { if (InventoryManager.playerInventory[i].itemID == 0) { noise.Play(); InventoryManager.playerInventory[i] = new Item(GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[itemID].itemName, itemType, GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[itemID].itemDescription, GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[itemID].itemIconName, itemID, GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[itemID].itemSellCost, 0, true); InventoryManager.playerInventory[i].itemQuantity = numSplit; InventoryManager.playerInventory[slotNumber].itemQuantity -= numSplit; print(InventoryManager.playerInventory[i].itemQuantity + " " + InventoryManager.playerInventory[slotNumber].itemQuantity); GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); splitPanel.SetActive(false); gameObject.SetActive(false); InventoryController.invMenuToggle = false; inMenu = false; itemFound = true; break; } } if (!itemFound) { error.Play(); splitPanel.SetActive(false); gameObject.SetActive(false); InventoryController.invMenuToggle = false; inMenu = false; } } } else if (hit.collider != null && hit.collider.tag == "Split_Item_No" && inMenu) { if (Input.GetMouseButtonDown(0)) { noise.Play(); splitPanel.SetActive(false); gameObject.SetActive(false); InventoryController.invMenuToggle = false; inMenu = false; } } else if (hit.collider != null && hit.collider.tag == "Split_Item_Add" && inMenu) { if (Input.GetMouseButtonDown(0) && numSplit < itemAmount - 1) { noise.Play(); numSplit++; splitTextNum.text = numSplit.ToString(); } else if (Input.GetMouseButtonDown(0) && numSplit >= itemAmount - 1) { error.Play(); } } else if (hit.collider != null && hit.collider.tag == "Split_Item_Sub" && inMenu) { if (Input.GetMouseButtonDown(0) && numSplit > 1) { noise.Play(); numSplit--; splitTextNum.text = numSplit.ToString(); } else if (Input.GetMouseButtonDown(0) && numSplit <= 1) { error.Play(); } } //If player hovers over destroy item confirm else if (hit.collider != null && hit.collider.tag == "Inv_Menu_Destroy" && !inMenu) { choiceHover = true; splitText.color = new Color(255, 255, 255); useText.color = new Color(255, 255, 255); destroyText.color = new Color(255, 255, 0); if (Input.GetMouseButtonDown(0) && InventoryManager.playerInventory[slotNumber].stackable && InventoryManager.playerInventory[slotNumber].itemID != 8 && InventoryManager.playerInventory[slotNumber].itemID != 9 && InventoryManager.playerInventory[slotNumber].itemID != 10) { noise.Play(); numDestroyed = 1; destroyTextNum.text = numDestroyed.ToString(); destroyPanel.SetActive(true); inMenu = true; } else if (Input.GetMouseButtonDown(0) && !InventoryManager.playerInventory[slotNumber].stackable && InventoryManager.playerInventory[slotNumber].itemID != 8 && InventoryManager.playerInventory[slotNumber].itemID != 9 && InventoryManager.playerInventory[slotNumber].itemID != 10) { noise.Play(); //InventoryManager.playerInventory[slotNumber].itemQuantity--; InventoryManager.playerInventory[slotNumber] = GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[0]; GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); gameObject.SetActive(false); InventoryController.invMenuToggle = false; } else { if (Input.GetMouseButtonDown(0)) { error.Play(); } } } else if (hit.collider != null && hit.collider.tag == "Destroy_Item_Yes" && inMenu) { if (Input.GetMouseButtonDown(0)) { noise.Play(); InventoryManager.playerInventory[slotNumber].itemQuantity -= numDestroyed; if (InventoryManager.playerInventory[slotNumber].itemQuantity <= 0) { InventoryManager.playerInventory[slotNumber] = GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[0]; } GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); destroyPanel.SetActive(false); gameObject.SetActive(false); inMenu = false; InventoryController.invMenuToggle = false; } } else if (hit.collider != null && hit.collider.tag == "Destroy_Item_No" && inMenu) { if (Input.GetMouseButtonDown(0)) { noise.Play(); destroyPanel.SetActive(false); gameObject.SetActive(false); inMenu = false; InventoryController.invMenuToggle = false; } } else if (hit.collider != null && hit.collider.tag == "Destroy_Item_Add" && inMenu) { if (Input.GetMouseButtonDown(0) && numDestroyed < itemAmount) { noise.Play(); numDestroyed++; destroyTextNum.text = numDestroyed.ToString(); } else if (Input.GetMouseButtonDown(0) && numDestroyed == itemAmount) { error.Play(); } } else if (hit.collider != null && hit.collider.tag == "Destroy_Item_Sub" && inMenu) { if (Input.GetMouseButtonDown(0) && numDestroyed > 1) { noise.Play(); numDestroyed--; destroyTextNum.text = numDestroyed.ToString(); } else if (Input.GetMouseButtonDown(0) && numDestroyed == 1) { error.Play(); } } else { choiceHover = false; useText.color = new Color(255, 255, 255); splitText.color = new Color(255, 255, 255); destroyText.color = new Color(255, 255, 255); } //Controller //Splitting items if (splitPanel.activeInHierarchy && GameController.xbox360Enabled() && inMenu) { if (InputManager.MainHorizontal() > .5f && !padBuffer) { if (numSplit < itemAmount - 1) { noise.Play(); numSplit++; splitTextNum.text = numSplit.ToString(); padBuffer = true; StartCoroutine(PadBuffer()); } else if (numSplit >= itemAmount - 1) { error.Play(); } } else if (InputManager.MainHorizontal() < -.5f && !padBuffer) { if (numSplit > 1) { noise.Play(); numSplit--; splitTextNum.text = numSplit.ToString(); padBuffer = true; StartCoroutine(PadBuffer()); } else if (numSplit <= 1) { error.Play(); } } else if (InputManager.A_Button()) { bool itemFound = false; //check for an empty inv slot for (int i = 0; i < InventoryManager.playerInventory.Length; i++) { if (InventoryManager.playerInventory[i].itemID == 0) { noise.Play(); InventoryManager.playerInventory[i] = new Item(GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[itemID].itemName, itemType, GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[itemID].itemDescription, GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[itemID].itemIconName, itemID, GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[itemID].itemSellCost, 0, true); InventoryManager.playerInventory[i].itemQuantity = numSplit; InventoryManager.playerInventory[slotNumber].itemQuantity -= numSplit; print(InventoryManager.playerInventory[i].itemQuantity + " " + InventoryManager.playerInventory[slotNumber].itemQuantity); GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); splitPanel.SetActive(false); gameObject.SetActive(false); InventoryController.invMenuToggle = false; inMenu = false; itemFound = true; break; } } if (!itemFound) { error.Play(); splitPanel.SetActive(false); gameObject.SetActive(false); InventoryController.invMenuToggle = false; inMenu = false; } } else if (InputManager.B_Button()) { noise.Play(); splitPanel.SetActive(false); gameObject.SetActive(false); InventoryController.invMenuToggle = false; inMenu = false; } } if (destroyPanel.activeInHierarchy && GameController.xbox360Enabled() && inMenu) { if (InputManager.MainHorizontal() > .5f && !padBuffer) { if (numDestroyed < itemAmount) { noise.Play(); numDestroyed++; destroyTextNum.text = numDestroyed.ToString(); padBuffer = true; StartCoroutine(PadBuffer()); } else if (numDestroyed == itemAmount) { error.Play(); } } else if (InputManager.MainHorizontal() < -.5f) { if (numDestroyed > 1 && !padBuffer) { noise.Play(); numDestroyed--; destroyTextNum.text = numDestroyed.ToString(); padBuffer = true; StartCoroutine(PadBuffer()); } else if (numDestroyed == 1) { error.Play(); } } else if (InputManager.A_Button()) { noise.Play(); InventoryManager.playerInventory[slotNumber].itemQuantity -= numDestroyed; if (InventoryManager.playerInventory[slotNumber].itemQuantity <= 0) { InventoryManager.playerInventory[slotNumber] = GameObject.Find("InventoryController").GetComponent <ItemDatabase>().itemData[0]; } GameObject.Find("InventoryController").GetComponent <InventoryController>().UpdateInventory(); destroyPanel.SetActive(false); gameObject.SetActive(false); inMenu = false; InventoryController.invMenuToggle = false; } else if (InputManager.B_Button()) { noise.Play(); destroyPanel.SetActive(false); gameObject.SetActive(false); inMenu = false; InventoryController.invMenuToggle = false; } } }
// Update is called once per frame void Update() { //Koros Forest if (levelID == 1) { int count = 0; for (int i = 0; i < Mosaic_Manager.korosMosaic.Length; i++) { if (Mosaic_Manager.korosMosaic[i]) { mosaic[i].SetActive(true); count++; } } if (count >= 9) { treasure.SetActive(true); } } //Mier Forest else if (levelID == 2) { int count = 0; for (int i = 0; i < Mosaic_Manager.mierMosaic.Length; i++) { if (Mosaic_Manager.mierMosaic[i]) { mosaic[i].SetActive(true); count++; } } if (count >= 9) { treasure.SetActive(true); } } //Galahad Tomb else if (levelID == 3) { int count = 0; for (int i = 0; i < Mosaic_Manager.tombMosaic.Length; i++) { if (Mosaic_Manager.tombMosaic[i]) { mosaic[i].SetActive(true); count++; } if (count >= 9) { treasure.SetActive(true); } } } //Dark Forest else if (levelID == 4) { int count = 0; for (int i = 0; i < Mosaic_Manager.darkMosaic.Length; i++) { mosaic[i].SetActive(true); count++; } if (count >= 9) { treasure.SetActive(true); } } float distance = Vector3.Distance(transform.position, TestCharController.player.transform.position); //print(distance); if (distance < .55 && !textMade) { interactText = Instantiate(Resources.Load("Prefabs/QuestionBubble") as GameObject, TestCharController.player.Find("Player_States_Panel").transform); textMade = true; } else if (distance >= .55) { Destroy(interactText); textMade = false; } //If interact is pressed if (distance < .55 && (InputManager.A_Button() || Input.GetKeyDown(KeyCode.F)) && !active && !TestCharController.inDialogue) { GameObject.Find("GenNoise").GetComponent <AudioSource>().Play(); StartCoroutine(MosaicTut()); } }
// Update is called once per frame void Update() { float distance = Vector3.Distance(transform.position, TestCharController.player.transform.position); //print(distance); if (distance < .35 && !textMade && !LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].isOpened) { if (GameController.xbox360Enabled()) { interactText = Instantiate(Resources.Load("Prefabs/Interact_XBox") as GameObject, new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity); } else { interactText = Instantiate(Resources.Load("Prefabs/Interact") as GameObject, new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity); } textMade = true; } else if (distance >= .35) { Destroy(interactText); textMade = false; } //If interact is pressed if (distance < .5 && !LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].isOpened && (InputManager.A_Button() || Input.GetKeyDown(KeyCode.F))) { LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].isOpened = true; GetComponent <AudioSource>().Play(); StartCoroutine(RemoveMosaic()); } }
IEnumerator WriteText(List <Dialogue> dialogueList) { if (resetChar) { if (TestCharController.player.GetComponent <TestCharController>().north) { TestCharController.player.GetComponent <Animator>().Play("TestUpIdle"); } else if (TestCharController.player.GetComponent <TestCharController>().south) { TestCharController.player.GetComponent <Animator>().Play("TestDownIdle"); } else if (TestCharController.player.GetComponent <TestCharController>().west) { TestCharController.player.GetComponent <Animator>().Play("TestLeftIdle"); } else { TestCharController.player.GetComponent <Animator>().Play("TestRightIdle"); } } if (GameController.xbox360Enabled()) { skipText.GetComponent <Text>().text = "Press B to Skip"; } if (noSkip) { skipText.SetActive(false); } dialogueDone = false; dialogueIMG.gameObject.SetActive(true); dialogueBackIMG.gameObject.SetActive(true); dialogueNPC.gameObject.SetActive(true); playerHUD.SetActive(false); compHUD.SetActive(false); if (!noMove) { moveCam = StartCoroutine(MoveCamera(TestCharController.player.transform.position)); } if (!noFade) { dialogueFade.gameObject.SetActive(true); } TestCharController.inDialogue = true; for (int i = 0; i < dialogueList.Count; i++) { scrollArrow.gameObject.SetActive(false); //entire dialogue skipped? if (skipDialogue) { break; } dialogueIMG.sprite = Resources.Load <Sprite>("Faces/" + dialogueList[i].dialogueForeIMG); if (dialogueList[i].activeIMG == 0) { dialogueIMG.color = new Color(1, 1, 1); } else { dialogueIMG.color = new Color(.5f, .5f, .5f); } dialogueBackIMG.sprite = Resources.Load <Sprite>("Faces/" + dialogueList[i].dialogueBackIMG); if (dialogueList[i].activeIMG == 1) { dialogueBackIMG.color = new Color(1, 1, 1); } else { dialogueBackIMG.color = new Color(.5f, .5f, .5f); } dialogueNPC.sprite = Resources.Load <Sprite>("Faces/" + dialogueList[i].dialogueNPC); if (dialogueList[i].activeIMG == 2) { dialogueNPC.color = new Color(1, 1, 1); } else { dialogueNPC.color = new Color(.5f, .5f, .5f); } dialogue = dialogueList[i].dialogueText; dialogueText.text = ""; dialogueName.text = dialogueList[i].dialogueName; //start writing the dialogue for (int j = 0; j < dialogue.Length; j++) { dialogueSkip = false; dialogueName.text = dialogueList[i].dialogueName; dialogueText.text += dialogue[j]; dialogueNoise.pitch = dialogueList[i].dialoguePitch; dialogueNoise.Play(); //entire dialogue skipped? if (skipDialogue) { break; } if (dialogue[j].ToString() == "." || dialogue[j].ToString() == "?" || dialogue[j].ToString() == "!") { yield return(new WaitForSeconds(.5f * speedFactor)); } else if (dialogue[j].ToString() == ";" || dialogue[j].ToString() == ":" || dialogue[j].ToString() == ",") { yield return(new WaitForSeconds(.25f * speedFactor)); } else { yield return(new WaitForSeconds(.035f * speedFactor)); } //check if the dialogue has been skipped. if (dialogueSkip && !dialogueWait) { dialogueText.text = dialogue; dialogueSkip = false; dialogueWait = true; break; } } yield return(new WaitForSeconds(1f)); scrollArrow.gameObject.SetActive(true); if (showShop) { shopPrompt.SetActive(true); if (GameController.xbox360Enabled()) { shopPrompt.GetComponent <Dialogue_Choice>().padY = 0; shopPrompt.GetComponent <Dialogue_Choice>().UpdateCursor(); } } else if (showChoice) { choicePrompt.SetActive(true); if (GameController.xbox360Enabled()) { shopPrompt.GetComponent <Dialogue_Choice>().padY = 0; shopPrompt.GetComponent <Dialogue_Choice>().UpdateCursor(); } } while (((!Input.GetMouseButtonDown(0) && !InputManager.A_Button()) || waitingDecision) && !skipDialogue) { yield return(null); } //Do the dialogue action if there is one if (dialogueList[i].dialogueAction != null) { yield return(StartCoroutine(dialogueList[i].dialogueAction)); } dialogueWait = false; dialogueSkip = false; } if (!noMove) { StopCoroutine(moveCam); } yield return(new WaitForSeconds(.5f)); skipDialogue = false; GameObject.Find("WipeScreen").GetComponent <Animator>().Play("FadeIn"); playerHUD.SetActive(true); if (TestCharController.companionID != 0) { compHUD.SetActive(true); } Camera.main.transform.localPosition = new Vector3(0, 0, -10); TestCharController.inDialogue = false; dialogueIMG.gameObject.SetActive(false); dialogueBackIMG.gameObject.SetActive(false); dialogueNPC.gameObject.SetActive(false); dialogueFade.gameObject.SetActive(false); scrollArrow.gameObject.SetActive(false); yield return(new WaitForSeconds(.1f)); showShop = false; showChoice = false; gameObject.SetActive(false); dialogueDone = true; waitingDecision = false; }
// Update is called once per frame void Update() { //Controller Enabled if (GameController.xbox360Enabled() && !controlBuffer && heroInterface.activeInHierarchy) { //Left if (InputManager.MainHorizontal() < 0) { selectedIndex--; if (selectedIndex < 0) { selectedIndex = heroFrames.Count - 1; } GameObject.Find("GenNoise").GetComponent <AudioSource>().Play(); StartCoroutine(ControllerBuffer()); } //Right else if (InputManager.MainHorizontal() > 0) { selectedIndex++; if (selectedIndex > heroFrames.Count - 1) { selectedIndex = 0; } GameObject.Find("GenNoise").GetComponent <AudioSource>().Play(); StartCoroutine(ControllerBuffer()); } //Update the Selection for (int i = 0; i < heroFrames.Count; i++) { if (i == selectedIndex && !inBuffer) { heroFrames[i].transform.Find("Controller_Selected").GetComponent <Animator>().Play("Soul_Frame_Selected"); heroFrames[i].transform.Find("A_Button").GetComponent <Animator>().Play("A_Button"); controllerTooltip.SetActive(true); controllerTooltip.transform.position = heroFrames[i].transform.position; List <GameObject> talents = new List <GameObject>(); foreach (Transform talent in heroFrames[i].transform.Find("Talent_Frame")) { talents.Add(talent.gameObject); } controllerTooltips[0].transform.Find("TalentName").GetComponent <Text>().text = talents[0].GetComponent <HUD_Talent_Tooptip>().skillName; controllerTooltips[0].transform.Find("TalentDesc").GetComponent <Text>().text = talents[0].GetComponent <HUD_Talent_Tooptip>().skillDesc; controllerTooltips[1].transform.Find("TalentName").GetComponent <Text>().text = talents[1].GetComponent <HUD_Talent_Tooptip>().skillName; controllerTooltips[1].transform.Find("TalentDesc").GetComponent <Text>().text = talents[1].GetComponent <HUD_Talent_Tooptip>().skillDesc; controllerTooltips[2].transform.Find("TalentName").GetComponent <Text>().text = talents[2].GetComponent <HUD_Talent_Tooptip>().skillName; controllerTooltips[2].transform.Find("TalentDesc").GetComponent <Text>().text = talents[2].GetComponent <HUD_Talent_Tooptip>().skillDesc; } else { heroFrames[i].transform.Find("Controller_Selected").GetComponent <Animator>().Play("Soul_Frame_Selected_Off"); heroFrames[i].transform.Find("A_Button").GetComponent <Animator>().Play("A_Button_Hide"); } //If a hero is selected if (InputManager.A_Button()) { AddUnlocked(); controllerTooltip.SetActive(false); } } } if (heroInterface.activeInHierarchy) { Vector3 worldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition); worldPoint.z = Camera.main.transform.position.z; Ray ray = new Ray(worldPoint, new Vector3(0, 0, 1)); RaycastHit2D hit = Physics2D.GetRayIntersection(ray); if (hit.collider != null && hit.collider.tag == "Skill_Preview") { mouseTooltip.gameObject.SetActive(true); mouseTooltip.transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, Input.mousePosition.z + 5)); mouseTooltip.transform.position = new Vector3(mouseTooltip.transform.position.x + .75f, mouseTooltip.transform.position.y - .35f, mouseTooltip.transform.position.z); //Find talent name GameObject tempObj = mouseTooltip.transform.Find("TalentName").gameObject; Text tempText = tempObj.GetComponent <Text>(); tempText.text = hit.collider.gameObject.GetComponent <HUD_Talent_Tooptip>().skillName; //Find talent Desc GameObject tempObj2 = mouseTooltip.transform.Find("TalentDesc").gameObject; Text tempText2 = tempObj2.GetComponent <Text>(); tempText2.text = hit.collider.gameObject.GetComponent <HUD_Talent_Tooptip>().skillDesc; } else { mouseTooltip.gameObject.SetActive(false); } } }
// Update is called once per frame void Update() { //Update player gold gold.text = InventoryManager.playerGold.ToString(); UpdatePage(); UpdateShopkeeper(); Vector3 worldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition); worldPoint.z = Camera.main.transform.position.z; Ray ray = new Ray(worldPoint, new Vector3(0, 0, 1)); RaycastHit2D hit = Physics2D.GetRayIntersection(ray); //Is the controller enabled? if (GameController.xbox360Enabled() && !sellMult.activeInHierarchy) { //Create the shop cursor if (interactCursor == null) { interactCursor = Instantiate(Resources.Load("Prefabs/Inventory/Inv_Cursor"), transform) as GameObject; } if (InputManager.L_Bumper()) { mainPadX = -1; mainPadY = -1; sidePadX = -1; sidePadY = -1; salePadX = -1; tabPadY = -1; BackPage(); } if (InputManager.R_Bumper()) { mainPadX = -1; mainPadY = -1; sidePadX = -1; sidePadY = -1; salePadX = -1; tabPadY = -1; NextPage(); } //Select Item if (InputManager.A_Button()) { if (selectedSlot != null) { if (mainPadX > -1) { selectedSlot.GetComponent <Shop_Slab>().BuyItem(); } else if (salePadX > -1) { selectedSlot.GetComponent <Shop_Slab>().BuyItem(); } else if (sidePadX > -1) { selectedSlot.GetComponent <Sell_Slot>().SellItem(); } } else if (tabPadY == 0) { GameObject.Find("GenNoise").GetComponent <AudioSource>().Play(); shopMode = 1; page = 0; UpdateShop(); } else if (tabPadY == 1) { GameObject.Find("GenNoise").GetComponent <AudioSource>().Play(); shopMode = 2; page = 0; UpdateShop(); } } //Close shop if (InputManager.B_Button()) { tooltip.SetActive(false); DoneButton(); } SetCursorPos(); DisplayTooltip(); } else { if (Input.GetMouseButtonDown(0)) { if (hit.collider != null && hit.collider.tag == "Buy_Tab") { GameObject.Find("GenNoise").GetComponent <AudioSource>().Play(); shopMode = 1; page = 0; UpdateShop(); } else if (hit.collider != null && hit.collider.tag == "BuyBack_Tab") { GameObject.Find("GenNoise").GetComponent <AudioSource>().Play(); shopMode = 2; page = 0; UpdateShop(); } } } //Tooltip if (hit.collider != null && hit.collider.tag == "Shop_Slab") { tooltip.SetActive(true); tooltip.transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, Input.mousePosition.z + 5)); tooltip.transform.position = new Vector3(tooltip.transform.position.x + 1f, tooltip.transform.position.y - .5f, tooltip.transform.position.z); //Find item name GameObject tempObj = tooltip.transform.Find("Item_Name").gameObject; Text tempText = tempObj.GetComponent <Text>(); tempText.text = hit.collider.gameObject.GetComponent <Shop_Slab>().itemName; //Find item desc tempObj = tooltip.transform.Find("Item_Desc").gameObject; tempText = tempObj.GetComponent <Text>(); tempText.text = hit.collider.gameObject.GetComponent <Shop_Slab>().itemDesc; //Find item type tempObj = tooltip.transform.Find("Item_Type").gameObject; tempText = tempObj.GetComponent <Text>(); tempText.text = hit.collider.gameObject.GetComponent <Shop_Slab>().itemType; //Find item sell tempObj = tooltip.transform.Find("Item_Sell1").gameObject; tempText = tempObj.GetComponent <Text>(); tempText.text = ""; tempObj = tooltip.transform.Find("Item_Sell2").gameObject; tempText = tempObj.GetComponent <Text>(); tempText.text = ""; } else if (hit.collider != null && hit.collider.tag == "Sell_Slot" && hit.collider.GetComponent <Sell_Slot>().id != 0) { tooltip.SetActive(true); tooltip.transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, Input.mousePosition.z + 5)); tooltip.transform.position = new Vector3(tooltip.transform.position.x - 1.35f, tooltip.transform.position.y - .5f, tooltip.transform.position.z); //Find item name GameObject tempObj = tooltip.transform.Find("Item_Name").gameObject; Text tempText = tempObj.GetComponent <Text>(); tempText.text = hit.collider.gameObject.GetComponent <Sell_Slot>().itemName; //Find item desc tempObj = tooltip.transform.Find("Item_Desc").gameObject; tempText = tempObj.GetComponent <Text>(); tempText.text = hit.collider.gameObject.GetComponent <Sell_Slot>().itemDesc; //Find item type tempObj = tooltip.transform.Find("Item_Type").gameObject; tempText = tempObj.GetComponent <Text>(); tempText.text = hit.collider.gameObject.GetComponent <Sell_Slot>().itemType; //Find item sell tempObj = tooltip.transform.Find("Item_Sell1").gameObject; tempText = tempObj.GetComponent <Text>(); tempText.text = "Sells for "; tempObj = tooltip.transform.Find("Item_Sell2").gameObject; tempText = tempObj.GetComponent <Text>(); tempText.text = hit.collider.gameObject.GetComponent <Sell_Slot>().sell.ToString() + " gold"; } else { if (!GameController.xbox360Enabled()) { tooltip.SetActive(false); } } }
// Update is called once per frame void Update() { //Check if the Chest has been opened if (LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].isOpened) { chestAnimator.Play("Chest_Open_Idle"); } switch (mosaicID) { default: break; case 1: if (Mosaic_Manager.korosClaimed) { LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].isOpened = true; } break; } /* * //raycast to see if its above an item slot * Vector3 worldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition); * worldPoint.z = Camera.main.transform.position.z; * Ray ray = new Ray(worldPoint, new Vector3(0, 0, 1)); * RaycastHit2D hit = Physics2D.GetRayIntersection(ray); * * if (Input.GetMouseButtonDown(0) && hit.collider != null && hit.collider.tag == "Treasure_TkAll") * { * takeAll.Play("DecipherButtonClick"); * GameObject.Find("GenNoise").GetComponent<AudioSource>().Play(); * for (int i = 0; i < LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].treasureInv.Length; i++) * { * if (LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].treasureInv[i] != null) * { * //check to see if item is in player inv * for (int j = 0; j < InventoryManager.playerInventory.Length; j++) * { * if (LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].treasureInv[i].itemID == * InventoryManager.playerInventory[j].itemID) * { * //Check if item is stackable * if (LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].treasureInv[i].stackable) * { * //Add the treasure item stack to the player item stack * InventoryManager.playerInventory[j].itemQuantity += LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].treasureInv[i].itemQuantity; * //Remove item from treasure inv * LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].treasureInv[i] = GameObject.Find("InventoryController").GetComponent<ItemDatabase>().itemData[0]; * } * } * //If item not found or is not stackable put it in an empty slot * else * { * for (int k = 0; k < InventoryManager.playerInventory.Length; k++) * { * if (InventoryManager.playerInventory[k].itemID == 0 || InventoryManager.playerInventory[k] == null) * { * InventoryManager.playerInventory[k] = LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].treasureInv[i]; * LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].treasureInv[i] = GameObject.Find("InventoryController").GetComponent<ItemDatabase>().itemData[0]; * } * } * } * } * } * //Update Treasure Inv * UpdateTreasureInv(); * //Update player inv * GameObject.Find("InventoryController").GetComponent<InventoryController>().UpdateInventory(); * * } * * } */ //check proximity of chest and player chestDistance = Vector3.Distance(transform.position, TestCharController.player.transform.position); //print(chestDistance); if (chestDistance <= .35f && !LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].isOpened) { if (!textMade) { if (GameController.xbox360Enabled()) { interactText = Instantiate(Resources.Load("Prefabs/Interact_XBox"), new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity) as GameObject; textMade = true; } else if (!GameController.xbox360Enabled()) { interactText = Instantiate(interactPrefab, new Vector2(transform.position.x + .35f, transform.position.y + .15f), Quaternion.identity); textMade = true; } } //On First open of the treasure chest if (InputManager.A_Button() && !LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].isOpened) { chestAnimator.Play("Open_Chest"); chestOpenNoise.Play(); LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].isOpened = true; CreateTreasure(); /* * GenerateTreasureSlots(); * UpdateTreasureInv(); * treasureUI.SetActive(true); * treasureUIOpen = true; * TestCharController.inTreasure = true; * GameObject.Find("InventoryController").GetComponent<InventoryController>().OpenInv(); * helpPanel.SetActive(true); * Destroy(interactText); * padX = 0; * padY = 0; * padActive = true; * StartCoroutine(PadBuffer()); */ } /* * //Every subsequent opening after the first * else if (InputManager.A_Button() && LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].isOpened && !treasureUIOpen) * { * if (slotList.Count == 0) * { * GenerateTreasureSlots(); * } * UpdateTreasureInv(); * treasureUI.SetActive(true); * treasureUIOpen = true; * TestCharController.inTreasure = true; * GameObject.Find("InventoryController").GetComponent<InventoryController>().OpenInv(); * helpPanel.SetActive(true); * Destroy(interactText); * padActive = true; * padX = 0; * padY = 0; * StartCoroutine(PadBuffer()); * } * * //Closing the chest UI * else if ((InputManager.B_Button() || Input.GetKeyDown(KeyCode.F)) && LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].isOpened && treasureUIOpen) * { * treasureUI.SetActive(false); * treasureUIOpen = false; * * GameObject.Find("InventoryController").GetComponent<InventoryController>().CloseInventory(); * helpPanel.SetActive(false); * padActive = false; * textMade = false; * * StartCoroutine(CloseRoutine()); * } */ } else if (chestDistance > .35f) { Destroy(interactText); //treasureUI.SetActive(false); //treasureUIOpen = false; TestCharController.inTreasure = false; //helpPanel.SetActive(false); padActive = false; textMade = false; } //Controller if (GameController.xbox360Enabled() && TestCharController.inTreasure) { TakeAll(); NavigateTreasure(); TakeItem(); } }
// Update is called once per frame void Update() { if (GameController.xbox360Enabled()) { if (InputManager.MainHorizontal() < 0 && !padActive && charX > -1) { GetComponent <AudioSource>().Play(); charX--; if (charX < 0) { charX = 1; } padActive = true; StartCoroutine(PadBuffer()); UpdateCursor(); } else if (InputManager.MainHorizontal() > 0 && !padActive && charX > -1) { GetComponent <AudioSource>().Play(); charX++; if (charX > 1) { charX = 0; } padActive = true; StartCoroutine(PadBuffer()); UpdateCursor(); } else if (InputManager.MainVertical() < 0 && !padActive && charY > -1) { GetComponent <AudioSource>().Play(); charY--; if (charY < 0) { charY = 1; } padActive = true; StartCoroutine(PadBuffer()); UpdateCursor(); } else if (InputManager.MainVertical() > 0 && !padActive && charY > -1) { GetComponent <AudioSource>().Play(); charY++; if (charY > 1) { charY = 0; } padActive = true; StartCoroutine(PadBuffer()); UpdateCursor(); } if (InputManager.A_Button()) { //Cecilia if (charX == 0 && charY == 0) { GetComponent <AudioSource>().Play(); SelectCecilia(); charX = -1; charY = -1; lastX = 0; lastY = 0; UpdateCursor(); } //Leon else if (charX == 1 && charY == 0) { GetComponent <AudioSource>().Play(); SelectLeon(); charX = -1; charY = -1; lastX = 1; lastY = 0; UpdateCursor(); } //Risette else if (charX == 0 && charY == 1) { GetComponent <AudioSource>().Play(); SelectRisette(); charX = -1; charY = -1; lastX = 0; lastY = 1; UpdateCursor(); } //Sparrow else if (charX == 1 && charY == 1) { GetComponent <AudioSource>().Play(); SelectSparrow(); charX = -1; charY = -1; lastX = 1; lastY = 1; UpdateCursor(); } else if (charX == -1 && charY == -1) { GetComponent <AudioSource>().Play(); StartGame(); } } if (InputManager.B_Button() && charX == -1 && charY == -1) { GetComponent <AudioSource>().Play(); charX = lastX; charY = lastY; UpdateCursor(); } } }