登录
  • 欢迎访问 Sharezer Blog

Hierarchy排序

    using UnityEditor; using UnityEngine; public class 升序排列 : BaseHierarchySort { public override GUIContent content { get { return new GUIContent("升序"); } } public override int Compare(GameObject lhs, GameObject rhs) { if (lhs == rhs)……继续阅读 »

sharezer 8年前 (2016-07-26) 3082浏览 0评论 0个赞

Unity GL画一条贝塞尔曲线

using UnityEngine; using System.Collections; using UnityEditor; using System.Collections.Generic; public class DrawLineWindow : EditorWindow { [MenuItem("Tools/测试")] public static void ShowWindow() { DrawLineWindow window = EditorWindow.GetWindow(typeof(DrawL……继续阅读 »

sharezer 8年前 (2016-07-15) 3617浏览 0评论 0个赞

Unity GL画直线

public class DrawLineWindow : EditorWindow { [MenuItem("Tools/测试")] public static void ShowWindow() { DrawLineWindow window = EditorWindow.GetWindow(typeof(DrawLineWindow)) as DrawLineWindow; window.Init(); } private Material lineMaterial; ……继续阅读 »

sharezer 8年前 (2016-07-15) 3676浏览 0评论 1个赞

【转】NGUI的NGUITools类

//转载地址:http://lizhiwei.me/?p=85 static public float soundVolume //该属性是全局音效播放音量,按照文档说是用于NGUITools.PlaySound(),那也就意味着我的游戏如果用NGUITools.PlaySound()管理游戏中的音效,同时也可以用于产品音效控制。 static public bool fileAccess //该属性用于检测是否可以访问用户磁盘 static public AudioSource PlaySound (AudioClip clip) static public AudioSource……继续阅读 »

sharezer 8年前 (2016-06-13) 2467浏览 0评论 0个赞

【C#笔记】接口 (interface)

接口 (interface) 定义了一个可由类和结构实现的协定。接口可以包含方法、属性、事件和索引器。接口 不提供它所定义的成员的实现 — 它仅指定实现该接口的类或结构必须提供的成员。 接口可支持多重继承。在下面的示例中,接口 IComboBox 同时从 ITextBox 和 IListBox 继承。 interface IControl {     void Paint(); } interface ITextBox: IControl {     void SetText(string……继续阅读 »

sharezer 8年前 (2016-06-13) 1910浏览 0评论 0个赞

【C#笔记】值类型 (value type) 和引用类型 (reference type)

C# 中的类型有两种:值类型 (value type) 和引用类型 (reference type)。值类型的变量直接包含它们的数据,而引用类型的变量存储对它们的数据的引用,后者称为对象。对于引用类型,两个变量可能引用同一个对象,因此对一个变量的操作可能影响另一个变量所引用的对象。对于值类型,每个变量都有它们自己的数据副本(除 ref 和 out 参数变量外),因此对一个变量的操作不可能影响另一个变量。 C# 的值类型进一步划分为简单类型 (simple type)、枚举类型 (enum type)、结构类型 (struct type) 和可以为 null 的类型 (nullable ty……继续阅读 »

sharezer 8年前 (2016-06-12) 2464浏览 0评论 0个赞

绘制子弹路径

在物理世界中,让子弹的刚体受到一个冲量,就可以简单的实现子弹的飞行。 Body.AddForce(Direction * Froce , ForceMode.Impulse); 而ForceMode.Impulse:此种方式采用瞬间力作用方式,即把t的值默认为1,不再采用系统的帧频间隔,即 f•1.0=m•v 那么v=f/m 如果射击的物体是移动的,那刚体的初速度则为射击物体的速度。 故v=v0+f/m 最近遇到一个需求,已知初速度和冲量,要绘制出子弹的轨迹。 如下图效果: 考虑把它分成x轴和y轴的运动。 即,在x轴上匀速运……继续阅读 »

sharezer 8年前 (2016-06-06) 2522浏览 0评论 0个赞

UnityEngine Attributes

AddComponentMenu 添加组件菜单(可以在UnityEditor的Component的Menu中增加自定义的项目) [AddComponentMenu("Transform/Follow Transform")] AssemblyIsEditorAssembly 汇编级属性,使用该属性的Class会被认为是EditorClass ColorUsageAttribute 用于配置颜色和颜色选择 ContextMenu 可以在Inspector的ContextMenu中增加选项 [ContextMenu……继续阅读 »

sharezer 8年前 (2016-06-03) 2402浏览 0评论 0个赞

AttributeTargets 枚举

指定可以对它们应用特性的应用程序元素 成员名称 说明 All 可以对任何应用程序元素应用属性。 Assembly 可以对程序集应用属性。 Class 可以对类应用属性。 Constructor 可以对构造函数应用属性。 Delegate ……继续阅读 »

sharezer 8年前 (2016-05-27) 1819浏览 0评论 0个赞