/// <summary> /// 创建圆柱形区域 /// </summary> /// <param name="id"> 命令ID,用作字典key </param> /// <param name="point"> 圆心点 </param> /// <param name="radius"> 半径 </param> /// <param name="height"> 高度 </param> public void CreateCylinder(Vector3 point, float radius, float height, Color color) { Mesh mesh = GLDraw.CreateCylinder(point, radius, height, color.Int32()); // 画出图形 Debug.Log(color.Int32().Color()); Game.GraphicsModule.AddGraphics(Camera.main, () => { ShapeMaterial.SetPass(0); Graphics.DrawMeshNow(mesh, Matrix4x4.identity); }); }
/// <summary> /// 创建两个圆柱,近距火力支援等待空域 /// </summary> /// <param name="id"> 命令ID,用作字典key </param> /// <param name="point">低点圆柱的底面圆心点</param> /// <param name="radius">半径</param> /// <param name="height">圆柱高度</param> /// <param name="heightDifference">两个圆柱的高度差</param> public void DoubleCylinder(Vector3 point, float radius, float height, float heightDifference, Color color) { // 下面圆柱 Mesh meshUp = GLDraw.CreateCylinder(point, radius, height, color.Int32()); // 上面圆柱 Vector3 highPoint = point + Vector3.up * (height + heightDifference); Mesh meshDown = GLDraw.CreateCylinder(highPoint, radius, height); Game.GraphicsModule.AddGraphics(Camera.main, () => { ShapeMaterial.SetPass(0); Graphics.DrawMeshNow(meshUp, Matrix4x4.identity); Graphics.DrawMeshNow(meshDown, Matrix4x4.identity); }); }