You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.3 KiB
54 lines
1.3 KiB
|
1 month ago
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UDE_HAND_INTERACTION;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class ArrowTipSample : MonoBehaviour
|
||
|
|
{
|
||
|
|
public GameObject[] Tip;
|
||
|
|
public Vector3 OriginalPos;
|
||
|
|
public Vector3 OriginalRot;
|
||
|
|
[HideInInspector]
|
||
|
|
public bool OnTarget = false;
|
||
|
|
|
||
|
|
void Start()
|
||
|
|
{
|
||
|
|
if (Tip.Length == 0) return;
|
||
|
|
for (int i = -88; i < 268; ++i)
|
||
|
|
{
|
||
|
|
if (i >= 89 && i <= 92) continue;
|
||
|
|
int index = i >= 90 ? 1 : 0;
|
||
|
|
GameObject go = Instantiate(Tip[index], transform.GetChild(0).Find("Tips"));
|
||
|
|
go.transform.localEulerAngles = new Vector3(0, 0, i);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private Transform Fruit;
|
||
|
|
public void SetFruit(Transform fruit)
|
||
|
|
{
|
||
|
|
Fruit = fruit;
|
||
|
|
Fruit.name = "Fruit";
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Reset()
|
||
|
|
{
|
||
|
|
var newobj = Instantiate(gameObject, null, true);
|
||
|
|
newobj.name = "NewArrow";
|
||
|
|
newobj.GetComponent<InteractableObject>().enabled = true;
|
||
|
|
if (Fruit != null)
|
||
|
|
{
|
||
|
|
Destroy(Fruit.gameObject);
|
||
|
|
}
|
||
|
|
var rigid = newobj.GetComponent<Rigidbody>();
|
||
|
|
rigid.velocity = Vector3.zero;
|
||
|
|
rigid.useGravity = false;
|
||
|
|
rigid.isKinematic = true;
|
||
|
|
newobj.transform.SetPositionAndRotation(OriginalPos, Quaternion.Euler(OriginalRot));
|
||
|
|
}
|
||
|
|
|
||
|
|
void Update()
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|