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) 3612浏览 0评论
0个赞
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个赞
//转载地址: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) 2466浏览 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) 2521浏览 0评论
0个赞
AddComponentMenu
添加组件菜单(可以在UnityEditor的Component的Menu中增加自定义的项目)
[AddComponentMenu("Transform/Follow Transform")]
AssemblyIsEditorAssembly
汇编级属性,使用该属性的Class会被认为是EditorClass
ColorUsageAttribute
用于配置颜色和颜色选择
ContextMenu
可以在Inspector的ContextMenu中增加选项
[ContextMenu……继续阅读 »
sharezer
8年前 (2016-06-03) 2401浏览 0评论
0个赞
为了从资源上优化安装包的大小,写了一个工具
点击查找,列出所以文件,并按从大到小的顺序排序
先上一下效果图
/// <summary>
/// 定义文件结构体
/// </summary>
public struct FileAttribute
{
public string path; //路径
public long size; /……继续阅读 »
sharezer
8年前 (2016-05-27) 2734浏览 0评论
0个赞
public static bool IsEnableTouchLayer(Camera cameraSeeTheLayer, string layer)
{
bool r = false;
string strLayer = "";
Vector3 posMouse = Input.mousePosition;
posMouse.z = 10;
Ray ray = cameraSee……继续阅读 »
sharezer
8年前 (2016-05-06) 2113浏览 0评论
0个赞
public void Update()
{
if (Input.GetMouseButton(0))
{
Vector3 pos = UICamera.currentCamera.ScreenToWorldPoint(Input.mousePosition);
test.transform.position = pos;
}
}
……继续阅读 »
sharezer
8年前 (2016-04-08) 3491浏览 2评论
0个赞
NGUI官网示例–讲解:http://game.ceeger.com/forum/read.php?tid=4172;fpage=2
NGUI官网示例2-interaction-讲解(一)http://game.ceeger.com/forum/read.php?tid=4179
NGUI官网示例2-interaction-讲解(二)http://game.ceeger.com/forum/read.php?tid=4180
NGUI官网示例3–Menu讲解http://game.ceeger.com/forum/read.php?tid=4187
NGUI官方实例—ControlIe……继续阅读 »
sharezer
8年前 (2016-04-08) 11881浏览 2评论
1个赞
AddObjectToAsset 将objectToAdd这个对象添加到指定路径上的现有资源
AssetPathToGUID 返回指定路径path下资源的GUID(全局唯一标识符)
ClearLabels 清除标签
Contains 资源中是否存在该对象
CopyAsset 复制指定路径的资源文件到一个新的路径
CreateAsset 在指定的路径新建资源
Crea……继续阅读 »
sharezer
8年前 (2016-01-06) 3906浏览 0评论
0个赞