随笔分类 - unlity3d
摘要:/** * 道具系统 */public class ItemBase implements Serializable { /** * 不可装备 */ public static final int ITEM_POS_NONE = 0; /** * 头部 */ public static final int ITEM_POS_HEAD = 1; /** * 胸部(盔甲) */ public static final int ITEM_POS_ARMOR = 2; /** * 脚部(靴子) *...
阅读全文
摘要:using UnityEngine;using System.Collections;public class showFPSManager : MonoBehaviour { private float FPS_updateInterval = 0.5F; private double FPS_lastInterval; private int FPS_frames = 0; private float FPS_fps; private string frameText; // Use this for initialization void...
阅读全文
摘要:using UnityEngine;using System.Collections;public class ChangeMusic : MonoBehaviour { //public GameObject music; UISlider uis_music; public GameObject music; AudioSource a; void OnSliderChange() { //Debug.Log("Music"); //ConstantData.MUSIC_VOLUME ...
阅读全文
摘要:void Skills_CD() { if(pData.mp>=P_EPZ) { Skill_panel.SetActiveRecursively(false); is_Sikll = false; }else { Skill_panel.SetActiveRecursively(true); } if(NeedSkillsCD>0) { NeedSkillsCD-=Time.deltaTime; ...
阅读全文
摘要:public class CameraShake : MonoBehaviour { // Use this for initialization Matrix4x4 originalProjection; float timer; void Start () { originalProjection = camera.projectionMatrix; //StartCoroutine(Shake(0.5f)); } // Update is called once per frame vo...
阅读全文
摘要:using UnityEngine;using System.Collections;public class StoryCamera_19 : MonoBehaviour { // Use this for initialization public Camera camera; public GameObject MainCamera; public GUISkin Story_01; private string[] DialogText_0; private string[] DialogText_1; private ...
阅读全文
摘要:一种以欧拉角度量的旋转。transform.eulerAngles(x,y,z);表示绕x,y,z分别旋转的度数。注意,只能对其设置绝对角度值,不建议使用+=来设置角度,因为超过360度会出现错误,若需要使用+=建议使用Transform.rotate(x,y,z)。且建议每次赋值都赋全(x,y,z)三个参数。即不建议使用诸如eulerAngles.x=10这样的赋值。demo:publicTransformtarget;publicfloatyRotation=5f;publicfloatxRotation=5f;//UsethisforinitializationvoidStart(){}
阅读全文
摘要:public float CalFPS() { ++FPS_frames; float timeNow = Time.realtimeSinceStartup; if (timeNow > FPS_lastInterval + FPS_updateInterval) { FPS_fps = (float)(FPS_frames / (timeNow - FPS_lastInterval)); FPS_frames = 0; ...
阅读全文
摘要:1.Input.touchCount 触摸随之增长一秒50次增量2.Input.GetTouch(0).phase==TouchPhase.Moved手指滑动中最后一帧滑动的状态 是运动的3.TouchPhase触摸的几个状态4.Touch.deltaPosition 增量位置(Input.GetTouch(0).deltaPosition)最后一帧滑动的值只返回xy轴坐标也可用vector3(z轴为0) 所以一般用vector2接收--------------------------------static var aa:int;function Update () {if(Input.to
阅读全文
摘要:1、随机数: NGUITOOLS.RandomRange(0,3);2、异步加载场景: Application.LoadLevelAsyn("abc场景名");-----------------------------------------------------AsyncOpration async=Application.LoadLevelAsync("level");3、任务栏Transform【】 allchildren=GetComponetsInChildren();4、生成随机位置(敌人)IEnumerator EnemyDelay(in
阅读全文
摘要:我的车控制AI战车前轮左右转弯的脚本//----------------varEnemyCar:GameObject;//定义敌人varattackRange=100.0;//定义距离vartarget:Transform;//定义目标为自己EnemyCar=GameObject.Find("Enemy");//实例化if(target==null)return;vartargetPoint=target.position;vartargetRotation=Quaternion.LookRotation(targetPoint-EnemyCar.transform.pos
阅读全文
摘要:数学知识太久没运用几何知识了,u3d也确实封装掉了太多的知识,搞得就只会用函数而不懂原理了,很多公式一时还真记不起来,这几天居然拿出了纸在推导一些公式,以怀念我从小学到大学值得骄傲的数学知识。1.角度与弧度互转(别告诉我连弧度是什么你都不知道了)弧度=角度*3.14159f/180.0f角度=弧度*180.0f/3.14159f向量旋转应用:staticfunctionRotateTowards(from:Vector3,to:Vector3,maxRadiansDelta:float,maxMagnitudeDelta:float):Vector3解释:将向量from向to向量旋转maxRa
阅读全文
摘要:unity 整合 vs2008 加快 unity c# 开发 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://mahaile.blog.51cto.com/2891586/752305 Unity3D中所使用的编程语言有三种:C#,JS和BOO。同时自带了免费的编辑器mono ,但在项目进行中mono 由于还未成熟,如代码提示,代码格式检验等效果不好 所以在windows下,编辑器还是VS最强大,并且c#更贴近面相对象的开发模式,更有利我们开发比较大型的项目,所以本文就探讨如何让Unity3D使用VS2008进行项目开发。
阅读全文
摘要:shaderLab关键字和函数 SubShader{ Tags{"Queue"="Transparent"} //渲染完不透明物体,再渲染当前物体 GrabPass{} //将当前屏幕抓取到_GrabTexture纹理变量中.之后的pass可以使用这张纹理. Pass{ Name "passName" //给pass起名 Material{ //[]取值符号 Diffuse[_diffuseColor] //反射光,颜色 Ambient[_ambient] //环境光,颜色 Specular[_specularColor] //高光颜
阅读全文

浙公网安备 33010602011771号