Unity布局如下
脚本:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RoleControl : MonoBehaviour
{
public GameObject bloodUI;
float wheelSpeed = 5f;
float speed = 5f;
float rotateSpeed = 5f;
float distance = 0;
bool rotate;
bool move;
float offset;
// Start is called before the first frame update
void Start()
{
if (bloodUI == null)
{
Debug.Log("血条引用丢失");
}
offset = Vector3.Distance( Camera.main.transform.position , transform.position);
}
// Update is called once per frame
void Update