【新增分类】
【AudioClips】音频剪辑
【AudioMixers】音频混合器
【Editor】
【Fonts】字体
【Materials】材质
【Models】模型
【Standard Assets】
【渲染调整】
Windows
——Lighting
————Scene
——————Ambient Color 颜色偏向
——————Auto 自动渲染
Camera
——projection{Orthographic}正交视野
【键盘控制】
FixedUpdate 固定帧
//物理位移一般放在这
float v = Input.GetAxis("Vertical");
//单人控制(WSAD与上下左右同时有效)
rigidbody.velocity = transform.forward*v*Speed;
//物体前面方向
float h = Input.GetAxis("HorizontalPlayer"+number);
//双人控制
rigidbody.angularVelocity = transform.up*h*angularSpeed;
//围绕Y轴
Rigidbody
Constraints
——Freeze position Y轴锁定
——Freeze Rotation x.y轴锁定
输入设置
Edit
——Project Settings
————Input
设置HorizontalPlayer1为WSAD
【子弹】
Capsule Collider 胶囊碰撞器
在Tank里设置一个空物体在炮口处
GameObject go = GameObject.Instantiate(shellPrefab, firePosition.position, firePosition.rotation) as GameObject;
//子弹位置为空物体位置,方向不改变
go.GetCompontent<Rigidbody>().velocity = go.tranform.forward*firePosition;
【爆炸特效】
Play On Awake 勾选上
GameObject.Instantiate(shellExplosionPrefab,transform.position,transform.rotation);
GameObject.Destroy(this.gameObject);
Destroy(this.gameObject,time);自动销毁,时间改为播放时间相同
【视野调整】
offset = transform.position - (player1.position+player2.position)/2
//初始偏移
transform.position = (player1.position+player2.position)/2+offset;
float distance = vector3.Distance(player1.position,player2.position)
float size = distance*0.58f; //根据相机大小除以他们开始距离
camera.orthographicSize = size;
【跟踪血条】
Slider滑动
——Fill
————Image Type {Filled} //360度填充
Canvas UI
——Render Mode {world Space} //世界空间,由Main Camera完成渲染
Canvas 修改小整体移动到Tank下