09 2018 档案
添加音效
摘要:定义成方法:using System.Collections; using System.Collections.Generic; using UnityEngine; public class AudioManger : MonoBehaviour { AudioSource au; public AudioClip[] clip = new AudioClip[3]; ...
阅读全文
在外面设置按键控制移动:
摘要:using System.Collections; using System.Collections.Generic; using UnityEngine; public class playcontrol : MonoBehaviour { public KeyCode upkey;//外面去指定键 public KeyCode downkey;//外面去指定键 ...
阅读全文
DoTween
摘要:dotween最原始的用法 using System.Collections; using System.Collections.Generic; using UnityEngine; using DG.Tweening; public class DotweenText : MonoBehaviour { public GameObject cube; public Rect...
阅读全文
寻路——AI
摘要:小球找到目标位置, 必要时候进行跳跃 进行跳跃时,需要在cube上加上 Off Mesh Link 组件,并添加起跳位置和目标位置 在static位置选Navigation static 编写脚本,挂在要运动的物体上
阅读全文
炮塔发射子弹
摘要:using System.Collections; using System.Collections.Generic; using UnityEngine; public class BuffShoot : MonoBehaviour { public GameObject Bu;//发射的子弹 public Transform tr;//发射子弹的位置 float t...
阅读全文
小球跳跃游戏
摘要:using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class SphereControll : MonoBehaviour { bool b = false; public float sphereSpeed=10...
阅读全文
iTween
摘要:using System.Collections; using System.Collections.Generic; using UnityEngine; public class ItweenText : MonoBehaviour { public GameObject obj; float time = 0; public iTween.EaseType typ...
阅读全文
编写脚本,开始场景有两个球体,两者之间距离为10,当距离大于10时,两个球相向运动,两个球接触后反向运动,反复运动
摘要:using System.Collections; using System.Collections.Generic; using UnityEngine; public class fanfuyundong09 : MonoBehaviour { public GameObject sphere;//定义另一个球 GameObject obj; float speed...
阅读全文
点击地面时,若鼠标点击的偶数次使得Cube向点击点移动,并且点击奇数次Cube变色
摘要:using System.Collections; using System.Collections.Generic; using UnityEngine; public class ray10 : MonoBehaviour { int num = 0; Vector3 vec; GameObject obj; bool b = false; Colo...
阅读全文
浙公网安备 33010602011771号