void Update() { if (cam == null) { if (cont.currScene == "Shop") { storeCont.storeDisplay(); } cam = Camera.main; } dir.x = Input.GetAxisRaw("Horizontal"); dir.y = Input.GetAxisRaw("Vertical"); mousePos = cam.ScreenToWorldPoint(Input.mousePosition); face(); #region weaponSwitch if (Input.GetKeyDown(KeyCode.P)) { die(); Debug.Log("Jack committed non-honorable seppuku."); } if (Input.GetKeyDown(KeyCode.Alpha1)) { equippedWeapon = gameObject.GetComponent <daggers>(); Debug.Log("Equipped Daggers."); } if (Input.GetKeyDown(KeyCode.Alpha2)) { equippedWeapon = gameObject.GetComponent <halberd>(); Debug.Log("Equipped Halberd."); } if (Input.GetKeyDown(KeyCode.Alpha3)) { } #endregion #region weaponAttack if (Input.GetButtonDown("Fire1")) { equippedWeapon.basicAttack(); } if (Input.GetButtonDown("Fire2")) { } if (Input.GetKeyDown(KeyCode.Space)) { } #endregion if (Input.GetKeyDown(KeyCode.LeftShift)) { } if (Input.GetKeyDown(KeyCode.B)) { cont.battleScene(); HP = maxHP; } }
void Update() { if (!dying) { rb.bodyType = RigidbodyType2D.Dynamic; if (cam == null) { if (cont.currScene == "Shop") { storeCont.storeDisplay(); } cam = Camera.main; } if (UI.GetComponent <Canvas>().worldCamera == null) { UI.GetComponent <Canvas>().worldCamera = Camera.main; } dir.x = Input.GetAxisRaw("Horizontal"); dir.y = Input.GetAxisRaw("Vertical"); mousePos = cam.ScreenToWorldPoint(Input.mousePosition); face(); #region weaponSwitch if (Input.GetKeyDown(KeyCode.Alpha1)) { equippedWeapon = gameObject.GetComponent <dagger>(); Debug.Log("Equipped Daggers."); dagger.equipped = true; halberd.equipped = false; bow.equipped = false; } if (Input.GetKeyDown(KeyCode.Alpha2)) { equippedWeapon = gameObject.GetComponent <halberd>(); Debug.Log("Equipped Halberd."); dagger.equipped = false; halberd.equipped = true; bow.equipped = false; } if (Input.GetKeyDown(KeyCode.Alpha3)) { equippedWeapon = gameObject.GetComponent <bow>(); Debug.Log("Equipped Bow."); dagger.equipped = false; halberd.equipped = false; bow.equipped = true; } #endregion #region weaponAttacks if (Input.GetButtonDown("Fire1")) { equippedWeapon.basicAttack(); } if (Input.GetButtonDown("Fire2")) { equippedWeapon.ability(); } if (Input.GetKeyDown(KeyCode.Space)) { equippedWeapon.ultimate(); } #endregion if (Input.GetKeyDown(KeyCode.LeftShift)) { } if (Input.GetKeyDown(KeyCode.E)) { if (Vector2.Distance(mousePos, transform.position) < 4) { transform.position = new Vector3(mousePos.x, mousePos.y, transform.position.z); } } if (Input.GetKeyDown(KeyCode.N)) { die(); } } else { rb.bodyType = RigidbodyType2D.Static; } }