3DDarkWonder

Terrain(地形)

Unity自带各种资源包。
Brush Size 设置笔刷大小,Opacity 设置精度大小,越小越不容易改变地形,适合细微操作。
Height 设置地面高度,只有有一定高度,地面才可以忘下陷。按住Shift。
第三个按钮是平滑操作,消除尖锐部分。
第四个按钮添加地形的贴图材质Textures。
第五个按钮绘画树木,需要添加树木的Prefab。
第六个添加草地Textures。
第七个可以设置地形的大小。

Character Controller(角色控制器)

这里写图片描述
Slope Limit :设置角色爬坡角度,默认45.90可以爬任何地形。然后设置角色的Collider大小。
脚本控制:首先 声明
private CharacterController characterController;
characterController=GetComponent();
摄像机固定,控制角色转向移动。在角色下创建Camera,设置好角度,点击GameObject的Align With view。
Update()=>
transform.Roate(new Vector3(0,Input.GetAxis(“Horizontal”)*30*Time.deltaTime,0));
characterController.SimpMove(transform.forward*speed*Input.GetAxis(“Vertical”));

角色控制的的转换

Player1 Player2 都使用CharacterController。设置一个标志位。
public bool isGetControl; 禁用其中一个Camera。
if(isGetControl)=>控制角色脚本
共同方法:
public void GetControl=>
isGetControl=true;
camera.setActive=true;
public void LossControl=>
isGetControl=false;
camera.setActive=false;
在其中一个角色脚本里控制转换。
public Player2 player2;
if(Input.GetKeyDown(KeyCode(Space))
=>if(isGetControl)
=>this.LossControl(); player2.GetControl();
else
=>this.GetControl(); palyer2.LossControl();

NPC自动行走

首先设置一个时间标志位 timer=2.0f; 如果时间到,就改变方向和状态。
Update()=>
timer-=Time.deltaTime;
if(timer<=0)=>
if(idel)=>
idle=false;
timer=5.0f;
transform.Roate(new Vector3(0,Random.range(90,-90),0));
walkAnimation;
else=>
idle=ture;
timer=2.0f;
idleAnimation;
if(!idle)=>
transform.SimpMove(transform.forword*speed);

OnGUI

void OnGUI=>
GUI.Lable(new Rect( x,y,length,width),”hello unity”);
bool yes = GUI.Button(new Rect(Screen.width/2,Screen.Length/2,40,20),”YES”);
if(yes)=>Debug.log(“OK”);

各种灯光

平行光(太阳光),点光源(灯泡),锥形光(手电筒),平面光(探照灯)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值