- 博客(13)
- 收藏
- 关注
转载 代码控制人物选择角色
1 public GameObject[] characterPrefabs;//在外部赋值的角色 2 private GameObject[] characterGameObjects;//在代码中赋值的角色 3 private int selectIndex = 0; //当前选择的角色 4 private int length; //...
2018-10-29 10:28:00
739
转载 三维人物跟随鼠标移动
//第一种写法 设置地板为Floor层 public float speed = 6f; private int floorMask;//layer层 void Awake() { floorMask = LayerMask.GetMask("Floor"); Turning(); ...
2018-10-09 16:58:00
787
转载 360全景图片
1 public float moveSpeed = 1;//物体旋转速度 2 public GameObject target; 3 4 private Vector2 oldPosition; 5 private Vector2 oldPosition1; 6 private Vector2 oldPo...
2018-09-28 11:06:00
191
转载 三维物体跟随鼠标移动
//上下 x(-45,15) //左右 y(-60,60) private float maxYRotation = 120; private float minYRotation = 0; private float maxXRotation = 60; private float minXRotation = 0; vo...
2018-09-26 18:06:00
452
转载 二维物体跟随鼠标移动
理解mousePos - transform.position 鼠标的位置减去挂在此脚本上物体的位置z = -Vector3.Angle(Vector3.up, mousePos - transform.position); Vector3.up为(0,1,0),这句话暂时理解为(0,1,0)和mousePos - transform.position夹角 ...
2018-09-26 18:04:00
129
转载 Unity自带的JsonUtility
1 [Serializable]//序列化 2 public class Person 3 { 4 public string name; 5 public int age; 6 } 7 8 [Serializable]//序列化 9 public class Persons10 {11 public Person[...
2018-09-25 14:29:00
237
转载 Json自带的JsonData类库
void Start () { Fun2(); // Fun3(); } //第二种方案 用Json自带的JsonData类库 private void Fun2() { //{ 'Heros':[{'name':'超人','power':95},{...
2018-09-25 14:27:00
568
转载 Json写类
1 public class Hero 2 { 3 public string name; 4 public int power; 5 6 } 7 public class Heros 8 { 9 public Hero[] heros;10 11 }12 13 public class ListJsonDe...
2018-09-25 14:25:00
309
转载 AVProVideo视频进度条
1,新建slider并添加事件 1 public MediaPlayer _mediaPlayer; 2 public Slider _videoSeekSlider; 3 public Text time; 4 float _setVideoSeekSliderValue; 5 private bool _wasPlayingO...
2018-09-19 14:42:00
2174
转载 unity打开网页
//打开网页 ID只有一个数字不同 传参 public void URLVideo(int ID) { string tempUrl = string.Format("https://www.bilibili.com/video/av1124944/?p={0}", ID); Application.OpenURL(temp...
2018-09-19 11:14:00
141
转载 异步加载场景
1 //动态加载的图片 public Image LoadingImage; //动态加载的数字 public Text processText; //动态加载的时间 float timer; void Update() { if (timer <= 1) { timer += ...
2018-09-19 10:11:00
95
转载 双击销毁物体
1 void Update () { 2 3 if (Input.GetMouseButtonDown(0)) 4 { 5 //向屏幕发生一条射线 6 Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); 7 ...
2018-09-18 17:45:00
129
转载 放大缩小物体
1 Vector2 oldPos1;//第一个手指 2 Vector2 oldPos2;//第二个手指 3 4 void Update() 5 { 6 //如果有2个手指 7 if (Input.touchCount == 2) 8 { 9 //如果第...
2018-09-18 17:35:00
161
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人