- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using Cinemachine;
- public class PhotoMode : MonoBehaviour
- {
- [SerializeField] PhotoCapture photoCapture;
- public CinemachineVirtualCameraBase vcam;
- public CinemachineVirtualCameraBase zoom;
- public GameObject projectile;
- public Transform projectileSpawnPoint;
- public StarterAssets.ThirdPersonController player;
- public float forcehold = 0f;
- private bool isPhotoModeOn;
- // Start is called before the first frame update
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- { //0 = left click 1 = right click
- //alt enter
- HandlePhotoModeInput();
- HandlePhotoCaptureInput();
- }
- private void HandlePhotoCaptureInput()
- {
- if (Input.GetMouseButtonDown(0))
- {
- photoCapture.OnClick(isPhotoModeOn);
- UiManager.singleton.ToggleCameraUi(true);
- }
- }
- private void HandlePhotoModeInput()
- {
- if (Input.GetMouseButtonDown(1)) //right click hold down zooms in
- {
- UiManager.singleton.ToggleCameraUi(true);
- player.SprintSpeed = 1;
- player.MoveSpeed = 1;
- zoom.Priority = 11;
- PhotoModeOn();
- Debug.Log("zoom");
- }
- else if (Input.GetMouseButtonUp(1)) //right click release zooms out
- {
- UiManager.singleton.ToggleCameraUi(false);
- player.SprintSpeed = 5.335f;
- player.MoveSpeed = 2;
- zoom.Priority = 9;
- isPhotoModeOn = false;
- }
- }
- private void PhotoModeOn()
- {
- isPhotoModeOn = true;
- }
- private void FireProjectile()
- {
- GameObject arrow = Instantiate(projectile, projectileSpawnPoint.position, projectileSpawnPoint.rotation);
- arrow.GetComponent<Projectile>().Setforce(forcehold);
- Debug.Log("shot");
- //instanite object
- //bring object back
- //give more power as project is hold down
- }
- }
[text] PohotMode
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new: