用unity写一个射击游戏鼠标左键点按准星放大,连按准星放大缩小,松开回到原来大小的代码
时间: 2023-03-16 17:43:36 浏览: 216
UnityC#,鼠标旋转,等比放大缩小,按键移动
我可以为你提供一段示例代码:using UnityEngine;public class ShootingGame : MonoBehaviour {// Use this for initializationvoid Start () {// Update is called once per framevoid Update () {if (Input.GetMouseButtonDown (0)) {transform.localScale *= 2;if (Input.GetMouseButton (0)) {transform.localScale *= 0.5f;if (Input.GetMouseButtonUp (0)) {transform.localScale = Vector3.one;}}}}
阅读全文