// Update is called once per frame void Update() { if (Input.GetKey(KeyCode.R)) { PlayerEquip.Reload(); } int keyUp = Input.GetKey(KeyCode.UpArrow) ? 1 : 0; int keyRight = Input.GetKey(KeyCode.RightArrow) ? 1 : 0; int keyDown = Input.GetKey(KeyCode.DownArrow) ? 1 : 0; int keyLeft = Input.GetKey(KeyCode.LeftArrow) ? 1 : 0; fireDirection = GetFireDirection(keyUp, keyRight, keyDown, keyLeft); if (fireDirection != FireDir.NONE) { switch (fireDirection) { case FireDir.UP: fireVector = new Vector3(0, 0, 1f); break; case FireDir.RIGHT: fireVector = new Vector3(1f, 0, 0); break; case FireDir.DOWN: fireVector = new Vector3(0, 0, -1f); break; case FireDir.LEFT: fireVector = new Vector3(-1f, 0, 0); break; } PlayerEquip.Shoot(gameObject.transform.position + new Vector3(fireVector.x * 0.8f, 0.5f, fireVector.z * 0.8f), fireVector); } }