-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfds.cs
43 lines (37 loc) · 1.11 KB
/
fds.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class fds : MonoBehaviour
{
public bool entertrigger;
void Start()
{
entertrigger = false;
GameObject.Find("Cube").AddComponent<MeshCollider>();//球与下面的抽象射线碰撞检测必须
}
void OnTriggerEnter(Collider coll)
{
if (coll.tag == "Player")
{
//GameObject.Find("Zombunny (1)").GetComponent<EnemyMovement>().enabled = true;
Debug.Log("dfsadsadsa");
}
}
void Update()
{
if (Input.GetMouseButtonDown(0))//鼠标左键点下
{
//住摄像机向鼠标位置发射射线
Ray mRay = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit mHit;
//射线检验
if (Physics.Raycast(mRay, out mHit))
{
if (mHit.collider.gameObject.tag == "flowers")
{
Debug.Log("dfsadsadsa");
}
}
}
}
}