screen Match mode->Match width or Haighy
screen Match mode->Match width or Haighy
Input.GetMouseButtonDown(0)
注释是进行一个鼠标抬起(按下?)的判断
Observable.EveryUpdate().Where()
unity是以米为单位
按住肯处键是以米为单位拖动的
transform.Translate(transform.forward * Time.deltaTime, Space.Self);
首先transform.forward是当前物体的物体坐标系的z轴在世界坐标系上的指向,那么就是系统根据物体本身的局部坐标计算出的世界坐标!!!,但是如果你用了Space.Self,需要的是局部坐标,那么你的transform.forward就会再次被转换成局部坐标。所以就造成了,如果你物体旋转度是30,transform.forward就是30度的方向,然后,transform.forward在计算成局部坐标就会变成再+30度,所以看起来就是世界坐标的60度方向移动。
为什么这么慢,看不了啊啊
.安卓sid
创建Common是请创建Framwork版本,防止后期unity不兼容
1.public override void HandleGameAciton(UIPanelType currentGamePanelType){if(currentGamePanelType==UIPanelType.WolfPanel){}else{if(nextPanel!null){
nextPanel.HandleGameAction(currentGamePanelType);}}}
2.protected override void OnInitPanel(){base.OnInitPanel();
killNumber=contentPane.GetChild("Tex_KillNumber").asTextField;
numberButtons=contentPane.GetChild("Group_KillNumber").asGroup;
transition=contentPane.GetTransition("t0");
killTransition=contentPane.GetTransition("t1");
for(int i=0;i<contentPane.numChildren;i++){
GButton gButton=contentPane.GetChildAt(i).asButton;
gButton.onClick.Add(()=>{
killNumber.text=gButton.title.ToString();messageManager.wolfKillNumber=System.Convert.ToInt32(gButton.title);});}}
WolfPanel脚本
定义成员变量
GTextField killNumber,GGroup numberButtons,Transition killTransition
找不到Manager可以刷新解决方案,可以不必关闭VS
WolfPanel脚本
1.OnInitPanel函数添加
certainButton.onClick.Add(()=>{
controller.selectedIndex=2;
messageController.selectedIndex=2;
transition.Stop();
killTransition.Play(()=>{
killNumber.text=0.ToString();
AfterAction(UIPanelType.witchPanel);});});
2.HandleGameAction(UIPanelType currentGamePanelType){
if(currentGamePanelType==UIPanelType.WolfPanel){
ToCurrentPanel();transition.Play(-1,0,()=>{});
for((int i=0;i<contentPane.numChildren;i++){
for(int j=0;j<messageManager.deadPlayerNum.Count;j++)
{
if(contentPane.GetChildAt(i).group==numberButtons){GButton gButton=contentPane.GetChildAt(i).asButton;
if(gButton.title==messageManager.deadPlayerNum[j].ToString()){
gButton.grayed=true;gButton.touchable=false;}
}}}}}
完善UIManager
1.GameUIManager()
定义GameBasePanel
dayNightPanel,wolfPanel,guardPanel,witchPanel,prophetPanel,hunterPanel
完善任务链wolfPanel.SetNextPanel(witchPanel).SetNextPanel(prophetPanel).SetNextPanel(hunterPanel).SetNextPanel(defenderPanel).SetNextPanel(dayNightPanel).SetNextPanel(wolfPanel);
字典添加界面内容
UIPanelDict[UIPanelTypeWolfPanel].Show();
GameBasePanel firstPanel=UIPanelDict[UIPanelType.WolfPanel] as GameBasePanel;
firstPanel.EnterPanel();
firstPanel.HandleGameAcition(UIPanel.WolfPanel);
2.BasePanel()
ChangePanelCallBack(UIPanelType otherPanel)函数增加
if(uiManager.isGameUIManager){
GameBasePanel nextPanel=uiManager.UIPanelDict[otherPanel] as GameBasePanel;
nextPanel.HandleGameAction(otherPanel);}
1.GameBasePanel脚本
在构造方法中,加入
messageManager=GameManager.Instance.messageManager;
if(uiPanelType==UIPanelType.DayNightPanel){isDayNightPanel=true;}
2.OnInitPanel方法
if(!isDayNightPanel){
openAnimCom,closeAnimCom,openEye,closeEye,certainButton获取
}
guideMessage,messageController,controller
3.public virtual void HandleGameAction(UIPanelType currentGamePanelType){}
4.public virtual void ToCurrentPanel()
{controller.selectedIndex=0;
messageController.selectedIndex=0;
openEye.visible=true;
closeEye.visible=false;
openEye.SetPlaySettings(1,16,1,1);
openEye.playing=true;
if(firstTimeInThisPanel)
{openEye.onPlayEnd.Add(()=>{controller.selectedIndex=1;messageController.selectedIndex=1;openEye.visible=false;})}
}
GameBasePanel补充
AfterAction(UIPanelType nextPanel){
if(!isDayNightPanel){
controller.selectedIndex=3;
messageController.selectedIndex=3;}
else{
controller.selectedIndex=8;}
ToNextPanel(nextPanel);}
ToNextPanel(UIPanelType nextPanel){
if(!isDayNightPanel){
closeEye.visible=true;
if(firstTimeInThisPanel){
firstTimeInThisPanel=false;
closeEye.onPlayEnd.Add(()=>{ToOtherPanel(nextType);
closeEye.visibl=false;});}
closeEye.SetPlaySettings(1,9,1,9);
closeEye.Playing=true;}
else{
Transition ToNight=contentPane.GetTransition("ToNight");
ToNight.play(()=>{ToOtherPanel(nextType);});}}
补充UIManager脚本
1.GameUIManager()
{isGameUIManager=true;
if(UIPanelDict.Count!=0){
ClearDict();}}
2.GamePanel文件夹添加脚本继承GameBasePanel
DayNigth,GuardPanel,Hunter,Prophet,Witch,Wolf;
sin 是锐角的对边比斜边
cos 定义是 锐角的邻边比斜边
tan 直角三角形中,锐角对应对边比邻边
推导 Cos 45°
根据勾股定理 a² + b² = c²
斜边 c² =^a² + b²
如果两条边都为1 ,即斜边 ^2
为了计算简化 分母有理化,是针对分母有无理数或无理式的分式而言的,分母有理化也就是把分式的分母变成有理数或有理式的过程。
上下分别乘以根号2
^2/2 是 分母有理化的来
Cos 45° = ^2/2
将好几个物体合并mesh
获取子物体中的meshfilter组件
创建combineinstance组件
for循环赋予combineinstance
sharemesh,局部赚世界的矩阵坐标transform.localtoworldmatrix
创建一个mesh mesh.combinemeshs
这节是贴图 然后可以加实时的阴影