纳金网
标题:
鼠标点击一个物体 物体周围出现一个圈
[打印本页]
作者:
烟雨
时间:
2015-5-29 02:53
标题:
鼠标点击一个物体 物体周围出现一个圈
鼠标点击一个物体 物体周围出现一个圈
using UnityEngine;
using System.Collections;
using UnityEditor;
public class css : MonoBehaviour
{
private GameObject s;
private GameObject no;
void Start()
{
}
void Update()
{
test_s();
}
void test_s()
{
if (no == null)
{
if (Input.GetMouseButtonDown(0))
{
for (int i = 0; i < Selection.gameObjects.Length; i++)
{
s = GameObject.CreatePrimitive(PrimitiveType.Cube);
no = Selection.gameObjects[i];
s.AddComponent<TrailRenderer>();
s.transform.position = new Vector3(Selection.gameObjects[i].transform.position.x, Selection.gameObjects[i].transform.position.y + 10f, Selection.gameObjects[i].transform.position.z);
}
}
else
return;
}
else
{
for (int i = 0; i < Selection.gameObjects.Length; i++)
s.transform.RotateAround(no.transform.position, new Vector3(0,0,10), 2000 * Time.deltaTime);
}
}
}
复制代码
欢迎光临 纳金网 (http://go.narkii.com/club/)
Powered by Discuz! X2.5