直接贴代码了 using UnityEngine; using System; using System.Collections; using System; using DataTable; public class ObjDropItem : ObjBase { //类型 public override OBJ.TYPE GetObjType() { return OBJ.TYPE.DROPITEM; } public const float MAXSPEED = 20; enum Stat…
1.在发射射线的位置创建一个空物体用于存储发射点的位置信息. 2.制作射线,为发射射线物体添加LineRenderer组件 制作Material材质并把其类型改为Particles/Addictive模式并为其加颜色把纹理放到LineRenderer的Material中,修改LineRenderer 的Width属性改成细线. 3.写脚本发射射线 public Transform rayPos; public LineRenderer rayLine; public int rayLength…
适用情景:主角带着光环,光环用一张贴图,要贴在地面上,并且随地面凹凸起伏 //代码 using UnityEngine; using System.Collections; [RequireComponent(typeof(MeshFilter))] [RequireComponent(typeof(MeshRenderer))] public class test : MonoBehaviour { private MeshFilter mFilter; private Mesh mMesh;…
这里就不多做解释了,直接上代码,只为了备忘. public class HeroMove : MonoBehaviour { private float speed;//人物行动速度 private Animation ani; // Use this for initialization void Start () { speed = 1f; ani = GetComponent<Animation> (); } // Update is called once per frame void…