// Update. private void Update() { float x = Input.GetAxis("Horizontal"); float y = Input.GetAxis("Vertical"); // Update direction. float absX = Mathf.Abs(x); float absY = Mathf.Abs(y); if (absX >= absY) { if (x < 0) { // Face left. Direction = Vector3.left; } else if (x > 0) { // Face right. Direction = Vector3.right; } } else if (absY > absX) { if (y < 0) { // Face down. Direction = Vector3.down; } else if (y > 0) { // Face up. Direction = Vector3.up; } } if (Input.GetButtonDown("Fire1")) { switch (ActiveWeaponSlot) { case WeaponSlot.Primary: PrimaryWeapon.Use(); break; case WeaponSlot.Secondary: break; } } }