纳金网

标题: 鼠标点击一个物体 物体周围出现一个圈 [打印本页]

作者: 烟雨    时间: 2015-5-29 02:53
标题: 鼠标点击一个物体 物体周围出现一个圈
鼠标点击一个物体 物体周围出现一个圈
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEditor;

  4. public class css : MonoBehaviour
  5. {
  6.     private GameObject s;
  7.     private GameObject no;

  8.     void Start()
  9.     {

  10.     }
  11.     void Update()
  12.     {
  13.         test_s();
  14.     }
  15.     void test_s()
  16.     {
  17.         if (no == null)
  18.         {
  19.             if (Input.GetMouseButtonDown(0))
  20.             {
  21.                 for (int i = 0; i < Selection.gameObjects.Length; i++)
  22.                 {
  23.                     s = GameObject.CreatePrimitive(PrimitiveType.Cube);
  24.                     no = Selection.gameObjects[i];
  25.                     s.AddComponent<TrailRenderer>();
  26.                     s.transform.position = new Vector3(Selection.gameObjects[i].transform.position.x, Selection.gameObjects[i].transform.position.y + 10f, Selection.gameObjects[i].transform.position.z);
  27.                 }
  28.             }
  29.             else
  30.                 return;
  31.         }
  32.         else
  33.         {
  34.             for (int i = 0; i < Selection.gameObjects.Length; i++)
  35.             s.transform.RotateAround(no.transform.position, new Vector3(0,0,10), 2000 * Time.deltaTime);
  36.         }
  37.     }

  38.    
  39. }
复制代码





欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5