void Update() { playerAnim.SetFloat("walkbikesurfstate", walkSurfBikeState); if (BIO.bioscreen.enabled) { disabled = true; } if (Input.GetKeyDown(KeyCode.H)) { StartCoroutine(BIO.DisplayABio(bionumber)); } if (transform.localPosition == new Vector3(10, -5, 0) && !HALLEVENT) { HALLEVENT = true; StartCoroutine(DoHallEvent()); } startmenu.SetActive(startmenuup); if (!disabled && !amenuactive) { if (Input.GetKeyDown(KeyCode.Return) && !moving) { startmenuup = true; moon.Initialize(); } top.SetActive(!disabled); bottom.SetActive(!disabled); playerAnim.SetBool("moving", moving); playerAnim.SetInteger("movedirection", direction); if (Input.GetKeyUp(KeyCode.DownArrow) || Input.GetKeyUp(KeyCode.RightArrow) || Input.GetKeyUp(KeyCode.LeftArrow) || Input.GetKeyUp(KeyCode.UpArrow)) { moving = false; } if (tr.position == pos) { transform.localPosition = new Vector3(Mathf.Round(transform.localPosition.x), Mathf.Round(transform.localPosition.y), 0); pos = tr.position; } if (direction == 1) { itemCheck = Physics2D.Raycast(transform.position, Vector2.up, 8, ItemMask); facingcheck = Physics2D.Raycast(transform.position, Vector2.up, 8, CollisionMask); } if (direction == 2) { itemCheck = Physics2D.Raycast(transform.position, Vector2.down, 8, ItemMask); facingcheck = Physics2D.Raycast(transform.position, Vector2.down, 8, CollisionMask); } if (direction == 3) { itemCheck = Physics2D.Raycast(transform.position, Vector2.left, 8, ItemMask); facingcheck = Physics2D.Raycast(transform.position, Vector2.left, 8, CollisionMask); } if (direction == 4) { itemCheck = Physics2D.Raycast(transform.position, Vector2.right, 8, ItemMask); facingcheck = Physics2D.Raycast(transform.position, Vector2.right, 8, CollisionMask); } if (facingcheck.collider != null) { if (tr.position == pos && facingcheck.distance - .5f < 0.01f) { facedtile = facingcheck.collider.gameObject; } else { facedtile = null; } } else { facedtile = null; } if (itemCheck.collider != null) { //print (itemCheck.distance.ToString ()); if (itemCheck.distance - .5f < 0.01f && !moving) { if (!moving && canInteractAgain && !PCactive && !shopup && !disabled && dia.finishedWithTextOverall && !startmenuup && !inBattle && !moving) { if (itemCheck.collider.tag.Contains("Interact") && !itemCheck.collider.tag.Contains("Player")) { if (Input.GetKeyDown(KeyCode.Z)) { if (itemCheck.collider.GetComponent <itemData> ().hasText) { if (itemCheck.collider.GetComponent <itemData> ().onlyonce) { if (!itemCheck.collider.GetComponent <itemData> ().triggered) { itemCheck.collider.GetComponent <itemData> ().triggered = true; canInteractAgain = false; IDB.PlayText(itemCheck.collider.GetComponent <itemData> ().TextID, itemCheck.collider.GetComponent <itemData> ().coinamount); } } else { if (itemCheck.collider.GetComponent <NPC> ()) { if (direction == 1) { itemCheck.collider.GetComponent <NPC> ().currentdir = NPC.FacingDirection.South; } if (direction == 2) { itemCheck.collider.GetComponent <NPC> ().currentdir = NPC.FacingDirection.North; } if (direction == 3) { itemCheck.collider.GetComponent <NPC> ().currentdir = NPC.FacingDirection.East; } if (direction == 4) { itemCheck.collider.GetComponent <NPC> ().currentdir = NPC.FacingDirection.West; } } canInteractAgain = false; IDB.PlayText(itemCheck.collider.GetComponent <itemData> ().TextID, itemCheck.collider.GetComponent <itemData> ().coinamount); } } } } } } } //Check collision here? } CheckCollision(); }
// Update is called once per frame void Update() { if (!selectingMon) { cursor.SetPosition(0, 112 - 16 * selectedSlot); } if (!cursor.isActive) { cursor.SetActive(true); } if (bio.displayingbio) { cursor.SetActive(false); } if (mainMenu.currentmenu == mainMenu.pokedexmenu) { if (Inputs.pressed("b") && !bio.displayingbio) { SoundManager.instance.PlayABSound(); if (Player.disabled) { Player.disabled = false; } if (selectingMon) { selectingMon = false; } else { Inputs.Enable("start"); mainMenu.currentmenu = mainMenu.thismenu; gameObject.SetActive(false); } } if (Inputs.pressed("a") && !bio.displayingbio) { SoundManager.instance.PlayABSound(); if (!selectingMon && GameData.instance.pokedexlist[topSlotIndex + selectedSlot - 1].seen) { selectingMon = true; cursor.SetPosition(120, 56); } else if (GameData.instance.pokedexlist[topSlotIndex + selectedSlot - 1].seen) { StartCoroutine(bio.DisplayABio(topSlotIndex + selectedSlot)); } } if (Inputs.pressed("down")) { if (!selectingMon) { selectedSlot++; if (selectedSlot > 6) { selectedSlot = 6; if (topSlotIndex < GameData.instance.pokedexlist.Count - 6) { topSlotIndex += 1; } UpdateScreen(); } } } if (Inputs.pressed("up")) { if (!selectingMon) { selectedSlot--; if (selectedSlot < 0) { selectedSlot = 0; if (topSlotIndex > 1) { topSlotIndex -= 1; } UpdateScreen(); } } } if (Inputs.pressed("right")) { if (!selectingMon) { topSlotIndex += 10; if (topSlotIndex > GameData.instance.pokedexlist.Count - 6) { topSlotIndex = GameData.instance.pokedexlist.Count - 6; } UpdateScreen(); } } if (Inputs.pressed("left")) { if (!selectingMon) { topSlotIndex -= 10; if (topSlotIndex < 1) { topSlotIndex = 1; } UpdateScreen(); } } } }