- 最后登录
- 2021-7-6
- 注册时间
- 2012-12-27
- 阅读权限
- 90
- 积分
- 76145
- 纳金币
- 53464
- 精华
- 316
|
模仿狙击枪开镜的代码- using UnityEngine;
- using System.Collections;
- public class Scope : MonoBehaviour {
- public bool click = false;
- // Use this for initialization
- void Start () {
- GetComponent<Camera>();
- }
- void OnClicks() {
- if (Input.GetMouseButtonDown(1))
- {
- click = !click;
- }
- if (click)
- {
- camera.depth = -1;
- }
- else
- {
- camera.depth = 1;
- }
- }
- // Update is called once per frame
- void Update () {
- OnClicks();
-
- }
- }
复制代码 |
|