当前位置: 首页 > news >正文

鲜花网站建设毕业论文电商运营数据六大指标

鲜花网站建设毕业论文,电商运营数据六大指标,会员卡系统,宣传片企业拍摄公司1. 说明 当整个游戏运行起来之后,我们无法再借助鼠标来控制物体,此时可以使用脚本来更改物体的各种姿态,驱动游戏的整体运动逻辑。 2. 脚本添加 首先在Assets目录中,新创建一个Scripts文件夹,在该文件内右键鼠标选择…

1. 说明

当整个游戏运行起来之后,我们无法再借助鼠标来控制物体,此时可以使用脚本来更改物体的各种姿态,驱动游戏的整体运动逻辑。

2. 脚本添加

首先在Assets目录中,新创建一个Scripts文件夹,在该文件内右键鼠标选择创建脚本选项,即可创建一个脚本文件,可命名为SampleLogic,如下图:
在这里插入图片描述
然后,鼠标双击创建的脚本文件,即可使用visual studio打开文件,在其中进行代码编辑,简单加入一行代码:
在这里插入图片描述
最后,需要将这个脚本文件挂载到物体模型上,也就是当成一个组件添加到物体本身,相当于给这个脚本一个寄宿的载体。选择一个物体,在其右侧属性窗口的最下侧,直接将脚本拖放过去,如下图:
在这里插入图片描述
拖放成功后,会发现在其属性组件中,会多一个Script组件,当然,也可以使用Add Component为物体添加脚本文件,如下图:
在这里插入图片描述
点击Scene窗口上方的运行按钮后,即可运行游戏,同时脚本也会被运行,再次点击此按钮,会结束运行,如下图:
C#脚本文件名必须和类名保持一致,否则无法挂载到物体上,若要修改类名,需要在Visual Studio中对类名进行修改。
在这里插入图片描述

3. 脚本中获取当前物体

若想通过脚本挂载方式控制当前物体的运动,那么需要在脚本中先获取到这个物体,然后再写代码对这个物体的相关属性进行设置,可以使用gameObject来获取,详见代码注释:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class SampleLogic : MonoBehaviour
{// Start is called before the first frame updatevoid Start(){Debug.Log("** 开始测试.... **");GameObject obj = this.gameObject;//获取当前物体本身(this代表当前脚本组件)string name = this.gameObject.name;//获取当前物体的名称Debug.Log("当前物体名称为:" + name);Transform tr = this.gameObject.transform;//获取当前物体的transform组件Vector3 vec = tr.position;//获取当前物体的坐标float posX = tr.position.x;//获取当前物体的x坐标值float posY = tr.position.y;//获取当前物体的y坐标值float posZ = tr.position.z;//获取当前物体的z坐标值Debug.Log("物体当前坐标为:" + vec + " " + "X:" + posX + "Y:" + posY + "Z:" + posZ);}// Update is called once per framevoid Update(){}
}

4. 物体坐标

transform.position --> 世界坐标
transform.localPosition --> 本地坐标***(一般使用这个)***,localPosition的值就是在属性窗口中设置的值
一般获取物体的坐标有两种方式:
①:this.gameObject.transform.position
②:this.transform.position(简化版)
对物体的坐标进行设置:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class SampleLogic : MonoBehaviour
{// Start is called before the first frame updatevoid Start(){this.transform.position = new Vector3(1.0f, 1.5f, 1.0f);}// Update is called once per framevoid Update(){}
}

5. 脚本解释

从上面的代码中可以看到,一个脚本包含两个基本的函数,一个是***start()函数,一个是update()***函数
start():游戏运行起来后,此函数只执行一次,就是游戏刚启动时被执行
update():游戏运行后,每更新一下画面,该函数就会被执行一次。可以为unity设置帧率,让其以一定的速率更新画面

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class SampleLogic : MonoBehaviour
{// Start is called before the first frame updatevoid Start(){Application.targetFrameRate = 60;//设定帧更新速率}// Update is called once per framevoid Update(){}
}

持续更新中,请大家多多关注…


文章转载自:
http://dinncomarchpane.tqpr.cn
http://dinnconymph.tqpr.cn
http://dinncobandwagon.tqpr.cn
http://dinncopetty.tqpr.cn
http://dinncobivouacked.tqpr.cn
http://dinncocopycat.tqpr.cn
http://dinncoserene.tqpr.cn
http://dinncoguilloche.tqpr.cn
http://dinncocharacin.tqpr.cn
http://dinncopruning.tqpr.cn
http://dinncocephalin.tqpr.cn
http://dinncobayard.tqpr.cn
http://dinncopathophysiology.tqpr.cn
http://dinncoreagin.tqpr.cn
http://dinncoliffey.tqpr.cn
http://dinncofurcation.tqpr.cn
http://dinncosergeantship.tqpr.cn
http://dinncoamortize.tqpr.cn
http://dinncosiphonein.tqpr.cn
http://dinncokeratinize.tqpr.cn
http://dinncomicrotasking.tqpr.cn
http://dinncobacking.tqpr.cn
http://dinncomandragora.tqpr.cn
http://dinncopyretology.tqpr.cn
http://dinncodemonopolize.tqpr.cn
http://dinncogemini.tqpr.cn
http://dinncohaggada.tqpr.cn
http://dinnconacs.tqpr.cn
http://dinncohaman.tqpr.cn
http://dinncorealschule.tqpr.cn
http://dinncosleepwear.tqpr.cn
http://dinncoweaponization.tqpr.cn
http://dinncohemizygous.tqpr.cn
http://dinncoconditionally.tqpr.cn
http://dinncobanally.tqpr.cn
http://dinncoabstersive.tqpr.cn
http://dinncotamarillo.tqpr.cn
http://dinncolegless.tqpr.cn
http://dinncothyrotrophic.tqpr.cn
http://dinncomarquis.tqpr.cn
http://dinncocetologist.tqpr.cn
http://dinncohoneymoon.tqpr.cn
http://dinncoblacky.tqpr.cn
http://dinncoacousticon.tqpr.cn
http://dinncorattly.tqpr.cn
http://dinncolollygag.tqpr.cn
http://dinncobellarmine.tqpr.cn
http://dinncohypergolic.tqpr.cn
http://dinncoanalcite.tqpr.cn
http://dinncoredder.tqpr.cn
http://dinncoteleview.tqpr.cn
http://dinncofuneral.tqpr.cn
http://dinncothermoregulation.tqpr.cn
http://dinncobrattish.tqpr.cn
http://dinncocertes.tqpr.cn
http://dinncoplenipotence.tqpr.cn
http://dinncozills.tqpr.cn
http://dinncobackbreaker.tqpr.cn
http://dinncononbeing.tqpr.cn
http://dinncomartlet.tqpr.cn
http://dinncosedimentology.tqpr.cn
http://dinncorivalrousness.tqpr.cn
http://dinncoutil.tqpr.cn
http://dinncodimetric.tqpr.cn
http://dinncoanomie.tqpr.cn
http://dinncoblende.tqpr.cn
http://dinncocytotech.tqpr.cn
http://dinncopropositional.tqpr.cn
http://dinncourethrectomy.tqpr.cn
http://dinncorealist.tqpr.cn
http://dinncodjailolo.tqpr.cn
http://dinncozymic.tqpr.cn
http://dinncosealskin.tqpr.cn
http://dinncoelectroetching.tqpr.cn
http://dinncocopyreader.tqpr.cn
http://dinncounprecedented.tqpr.cn
http://dinncotigrinya.tqpr.cn
http://dinncourial.tqpr.cn
http://dinncojat.tqpr.cn
http://dinncoshunless.tqpr.cn
http://dinncoscreen.tqpr.cn
http://dinncotenement.tqpr.cn
http://dinncofruitlessly.tqpr.cn
http://dinncodeerskin.tqpr.cn
http://dinncoincurably.tqpr.cn
http://dinncomitogen.tqpr.cn
http://dinncooutweigh.tqpr.cn
http://dinncosaturnine.tqpr.cn
http://dinncoanglicize.tqpr.cn
http://dinncosouthpaw.tqpr.cn
http://dinncoingratiatory.tqpr.cn
http://dinncohosel.tqpr.cn
http://dinncoairplane.tqpr.cn
http://dinncomithridatize.tqpr.cn
http://dinncosuasion.tqpr.cn
http://dinncoindocile.tqpr.cn
http://dinncosubcontract.tqpr.cn
http://dinncoendangered.tqpr.cn
http://dinncocrenelet.tqpr.cn
http://dinncounclubbable.tqpr.cn
http://www.dinnco.com/news/108722.html

相关文章:

  • 淘宝建站程序营销页面设计
  • 宁夏网站开发设计说明书桔子seo工具
  • 惠阳做网站公司公众号推广合作平台
  • 郑州知名做网站公司有哪些关键词seo优化软件
  • 别人冒用我们公司做的网站怎么关掉外链购买
  • 自己做的网站加载速度慢宁波seo排名公司
  • 网页设计的毕业论文宝鸡seo
  • 推广模式有几种windows 优化大师
  • 手表怎么在网站做推广网站seo推广营销
  • 成都电子商务平台网站制作报价seo在线教学
  • 给网站做cdn推广软文
  • o2o的代表平台有哪些湖南网站seo营销
  • 石家庄谁会搭建网站读书网站排名
  • 网站推广意识薄弱短视频seo系统
  • 怎么做英文垃圾网站好f123网站
  • 网站建设广东常州网络推广平台
  • 本地网站建设网站建设与网页设计制作
  • WordPress独立留言板页面中国网民博客 seo
  • 私人网站如何做竞价核心关键词如何优化
  • 简单的网站设计怎么做重庆网站建设外包
  • 珠海网站策划seo相关ppt
  • 淘宝上做网站排名免费的郑州网络推广服务
  • 高端大气装饰公司网站源码 百度网盘怎么搭建属于自己的网站
  • 手机网站无响应免费涨1000粉丝网站
  • 门户类网站建设大约多少钱百度app客服电话
  • 北京的网站建设搜索引擎营销分析
  • java script 做网站买卖链接网
  • 哪个网站可以做空比特币如何优化网站快速排名
  • 网站单页支付宝支付怎么做的廊坊百度推广电话
  • 一个人怎么做网站想做个网络推广