Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class MouseTest : MonoBehaviour
- {
- float moveSum;
- float scrollSum;
- void Start ()
- {
- Camera.main.orthographic = true;
- Camera.main.transform.position = Vector3.up * 10;
- Camera.main.transform.LookAt (Vector3.zero);
- }
- void Update ()
- {
- transform.position = new Vector3 (Mathf.Cos (Time.time), 0, Mathf.Sin (Time.time)) * 4.5f;
- if (Input.GetMouseButtonDown (0))
- moveSum = 0;
- if (Input.GetMouseButtonDown (1))
- scrollSum = 0;
- if (Input.GetMouseButton (0))
- moveSum += new Vector2 (Input.GetAxis ("Mouse X"), Input.GetAxis ("Mouse Y")).magnitude;
- scrollSum += Mathf.Abs (Input.GetAxis ("Mouse ScrollWheel"));
- }
- void OnGUI ()
- {
- GUI.Label (new Rect (Screen.width / 2, Screen.height / 2, 100, 100), "" + moveSum + "\n" + scrollSum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement