当前位置: 首页 > news >正文

网站怎么做百度推广网站开发者模式

网站怎么做百度推广,网站开发者模式,河东集团网站建设,低价网站建设扬州根据输入的物体生成随机成组的物体. 1 /// summary2 /// 本脚本可以由输入的预制 生成以本物体为中心的随机预制,支持预制打组3 /// 随机物体生成器(尤其试用于场景中静态物体随机摆放)4 /// /summary5 using UnityEngine;6 using System.Collections;7 using …根据输入的物体生成随机成组的物体.   1 /// summary2 /// 本脚本可以由输入的预制 生成以本物体为中心的随机预制,支持预制打组3 /// 随机物体生成器(尤其试用于场景中静态物体随机摆放)4 /// /summary5 using UnityEngine;6 using System.Collections;7 using System.Collections.Generic;8 9 public class PrefabMixer : MonoBehaviour10 {11 [Tooltip(输入预制)]12 public GameObject[]13 inputPrefabs;14 [Tooltip(生成多少组)]15 public int16 maxGroupsNum 3;17 [Tooltip(每组最多的个数)]18 public int19 maxEachGroupsNum 5;20 [Tooltip(距离中心的距离)]21 public float22 distanceToSpawn 50f;23 [Tooltip(缩放范围)]24 public float25 scaleToSpawn 5f;26 27 //一共生成多少组28 public ListTransform asteroidsGroupList new ListTransform ();29 //生成的陨石总数30 private ListTransform asteroidsList new ListTransform ();31 32 private Transform _cacheTransform;33 34 void OnEnable ()35 {36 ResetList ();37 _cacheTransform transform;38 Debug.Log(Cache Transform !!);39 }40 41 void OnDisable ()42 {43 ResetList ();44 }45 46 public void GenerateAsteroids ()47 {48 if (inputPrefabs null || inputPrefabs.Length 0)49 {50 Debug.LogError (预制不能为空哦 !);51 return;52 }53 54 if(_cacheTransform null)55 {56 _cacheTransform transform;57 }58 59 int tempMap 0;60 ResetList ();61 //按组数来判断62 while (asteroidsGroupList.Count maxGroupsNum) {63 64 Transform o new GameObject (AsteroidsMap_ tempMap ).transform;65 o.localPosition _cacheTransform.position;66 o.localRotation Quaternion.identity;67 o.localScale Vector3.one;68 if(o.GetComponentRotateSelf() null)69 o.gameObject.AddComponentRotateSelf();70 o.GetComponentRotateSelf().speed Random.Range(1,5f);71 72 73 for (int i 0; iRandom.Range(1,maxEachGroupsNum 1); i) {74 if (GetRandomPrefab () null)75 continue;76 GameObject asteroid Instantiate (GetRandomPrefab ()) as GameObject;77 asteroid.transform.parent o.transform;78 asteroid.name asteroid_ GetRandomPrefab ().name _ i;79 asteroid.transform.localRotation Quaternion.Euler (Random.Range (0, 360), Random.Range (0, 360), Random.Range (0, 360));80 asteroid.transform.localPosition Random.insideUnitSphere * distanceToSpawn;81 asteroid.transform.localScale new Vector3 (Random.Range (1, scaleToSpawn), Random.Range (1, scaleToSpawn), Random.Range (1, scaleToSpawn));82 83 }84 asteroidsGroupList.Add (o);85 }86 }87 88 public void ResetList ()89 {90 for (int i 0; i asteroidsGroupList.Count asteroidsGroupList.Count 0; i) {91 if(asteroidsGroupList [i] null)92 continue;93 // #if UNITY_3_594 // asteroidsGroupList[i].gameObject.active false; 95 // #endif96 // asteroidsGroupList [i].gameObject.SetActive (false);97 DestroyImmediate(asteroidsGroupList [i].gameObject);98 99 } 100 101 if (asteroidsGroupList.Count 0) 102 asteroidsGroupList.Clear (); 103 } 104 105 GameObject GetRandomPrefab () 106 { 107 if (inputPrefabs ! null inputPrefabs.Length 0) 108 return inputPrefabs [Random.Range (0, inputPrefabs.Length)]; 109 return null; 110 } 111 112 }       1 /// summary2 /// Prefab mixer editor.3 /// /summary4 using UnityEditor;5 using UnityEngine;6 using System.Collections.Generic;7 8 [CustomEditor(typeof(PrefabMixer))]9 public class PrefabMixerEditor : Editor { 10 SerializedObject myTarget; 11 12 SerializedProperty maxEachGroupsNum; 13 SerializedProperty maxGroupsNum; 14 SerializedProperty distanceToSpawn; 15 SerializedProperty scaleToSpawn; 16 SerializedProperty GenerateAsteroids; 17 // SerializedProperty asteroidsGroupList; 18 19 20 PrefabMixer prefabMixer; 21 private ListTransform asteroidsGroupList new ListTransform (); 22 23 void OnEnable() 24 { 25 myTarget new SerializedObject(target); 26 27 maxGroupsNum myTarget.FindProperty(maxGroupsNum); 28 maxEachGroupsNum myTarget.FindProperty(maxEachGroupsNum); 29 distanceToSpawn myTarget.FindProperty(distanceToSpawn); 30 scaleToSpawn myTarget.FindProperty(scaleToSpawn); 31 // asteroidsGroupList myTarget.FindProperty(asteroidsGroupList); 32 33 //获得实例 34 prefabMixer target as PrefabMixer; 35 asteroidsGroupList prefabMixer.asteroidsGroupList; 36 37 } 38 39 private bool _showPrefabs true; 40 41 public override void OnInspectorGUI() 42 { 43 myTarget.Update(); 44 45 EditorGUILayout.Separator(); 46 47 _showPrefabs EditorGUILayout.Foldout(_showPrefabs, 单个预制); 48 EditorGUIUtility.LookLikeInspector(); 49 if (_showPrefabs) { 50 ArrayGUI(myTarget, inputPrefabs); 51 } 52 EditorGUIUtility.LookLikeControls(); 53 54 EditorGUILayout.Separator(); 55 56 maxGroupsNum.intValue EditorGUILayout.IntSlider(生成多少组, maxGroupsNum.intValue, 1, 1000); 57 EditorGUILayout.Separator(); 58 59 maxEachGroupsNum.intValue EditorGUILayout.IntSlider(每组最多的个数, maxEachGroupsNum.intValue, 1, 100); 60 EditorGUILayout.Separator(); 61 62 distanceToSpawn.floatValue EditorGUILayout.Slider(距离中心的距离, distanceToSpawn.floatValue, 1f, 100f); 63 EditorGUILayout.Separator(); 64 65 scaleToSpawn.floatValue EditorGUILayout.Slider(缩放范围, scaleToSpawn.floatValue, 1f, 10f); 66 EditorGUILayout.Separator(); 67 68 if(GUILayout.Button(生成)) 69 { 70 prefabMixer.GenerateAsteroids(); 71 } 72 EditorGUILayout.Separator(); 73 74 if(GUILayout.Button(清空)) 75 { 76 prefabMixer.ResetList(); 77 } 78 EditorGUILayout.Separator(); 79 80 myTarget.ApplyModifiedProperties(); 81 } 82 83 84 void ArrayGUI(SerializedObject obj, string name) { 85 int size obj.FindProperty(name .Array.size).intValue; 86 int newSize EditorGUILayout.IntField(数量, size); 87 if (newSize ! size) obj.FindProperty(name .Array.size).intValue newSize; 88 EditorGUI.indentLevel 3; 89 for (int i0;inewSize;i) { 90 var prop obj.FindProperty(string.Format({0}.Array.data[{1}], name, i)); 91 EditorGUILayout.PropertyField(prop); 92 } 93 EditorGUI.indentLevel 0; 94 } 95 }  转载于:https://www.cnblogs.com/leesymbol/p/5018290.html
http://www.pierceye.com/news/355074/

相关文章:

  • 学校网站设计制作目的做网站推广方法
  • wordpress建站云平台小程序商城开发平台
  • pc网站转换成微网站网站建设开发哪家质量好
  • wordpress网站使用教程aspnet东莞网站建设多少钱
  • 网站地图提交给百度证券公司如何拉客户
  • 做外贸有哪些免费的网站win7优化大师好不好
  • 网站功能怎么写上海网站制作建设怎么样
  • 网站域名是网站架构吗成都网站搭建优化推广
  • 自己做的网站添加交费功能合肥有什么好的网站建设公司好
  • 做网站品牌龙岩新增病例行动轨迹
  • 任家房网站建设郑州百度网站推广
  • 深圳建设网站的公司简介WordPress多功能投稿
  • 简述织梦网站上传及安怎样在网站上做免费的推广
  • 关于信用体系建设的网站wordpress新闻类模板下载
  • 免费行情软件网站下载大全爱学校vi设计案例
  • 网站外包优化怎样做免费抽皮肤的网站
  • 东八区网站建设网站源码在哪里
  • 重点建设专业 专题网站搜狗官方网站
  • 微信营销工具有哪些使用最佳搜索引擎优化工具
  • 网站推广意识薄弱wordpress授权协议
  • 用php做高中数学题库网站阿里网站建设教程
  • 大兴网站建设公司电话东莞企业网站制作怎么做
  • 网站维护有啥用2021跨境电商最火的产品
  • 专业的东莞网站排名wordpress 客户端使用
  • 做网站需要什么人才网站建设与规划案例
  • 你学做网站学了多久建设网站困难的解决办法
  • 东莞如何搭建网站建设做招聘信息的网站
  • 网站行业认证怎么做安卓开发技术
  • 泉州城乡住房建设厅网站网站运营方案ppt
  • 免费做网站wxp114五种常用的网站推广方法