丢弃按钮,捡起按钮
This commit is contained in:
parent
dfd654db8d
commit
1b6e787ec6
File diff suppressed because it is too large
Load Diff
@ -36,6 +36,17 @@ public class UseSkill : MonoBehaviour
|
|||||||
{
|
{
|
||||||
Skill_Watering();
|
Skill_Watering();
|
||||||
Skill_Pick();
|
Skill_Pick();
|
||||||
|
if (currentItem != null)
|
||||||
|
{
|
||||||
|
if(currentItem.gameObject.name=="gun")
|
||||||
|
{
|
||||||
|
float dis= Vector3.Distance(GameObject.Find("player").transform.position, XFS.instance.transform.position);
|
||||||
|
if (dis >= 20f)
|
||||||
|
{
|
||||||
|
Drop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//Á¬½ÓË®¹Ü
|
//Á¬½ÓË®¹Ü
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
|
|
||||||
@ -11,6 +12,7 @@ public class JoystickController : MonoBehaviour, IDragHandler, IEndDragHandler
|
|||||||
public Camera playerCamera; // 摄像机
|
public Camera playerCamera; // 摄像机
|
||||||
public float rotationSpeed = 0.5f; // 摄像机旋转速度
|
public float rotationSpeed = 0.5f; // 摄像机旋转速度
|
||||||
|
|
||||||
|
public Transform target;
|
||||||
// 旋转角度限制
|
// 旋转角度限制
|
||||||
public float horizontalMinRotation = -75f; // 水平旋转最小值
|
public float horizontalMinRotation = -75f; // 水平旋转最小值
|
||||||
public float horizontalMaxRotation = 75f; // 水平旋转最大值
|
public float horizontalMaxRotation = 75f; // 水平旋转最大值
|
||||||
@ -40,6 +42,7 @@ public class JoystickController : MonoBehaviour, IDragHandler, IEndDragHandler
|
|||||||
{
|
{
|
||||||
if (joystickInput.magnitude > 0)
|
if (joystickInput.magnitude > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
// 根据摇杆的输入控制摄像机旋转
|
// 根据摇杆的输入控制摄像机旋转
|
||||||
targetXRotation += joystickInput.x * rotationSpeed * Time.deltaTime;
|
targetXRotation += joystickInput.x * rotationSpeed * Time.deltaTime;
|
||||||
targetYRotation -= joystickInput.y * rotationSpeed * Time.deltaTime;
|
targetYRotation -= joystickInput.y * rotationSpeed * Time.deltaTime;
|
||||||
@ -52,6 +55,7 @@ public class JoystickController : MonoBehaviour, IDragHandler, IEndDragHandler
|
|||||||
|
|
||||||
// 使用 Quaternion 来平滑过渡到目标旋转角度
|
// 使用 Quaternion 来平滑过渡到目标旋转角度
|
||||||
playerCamera.transform.localRotation = Quaternion.Euler(targetYRotation, targetXRotation, 0f);
|
playerCamera.transform.localRotation = Quaternion.Euler(targetYRotation, targetXRotation, 0f);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user