平面设计的网站有哪些平台推广怎么做

张小明 2026/3/12 5:28:12
平面设计的网站有哪些,平台推广怎么做,logo制作方法,网络建设解决方案专业公司视频链接#xff1a; https://www.bilibili.com/video/BV1wT9rYZEKe?spm_id_from333.788.videopod.sectionsvd_source25b783f5f945c4507229e9dec657b5bb 本教程涉及到 Unity 常用组件、常用方法等核心知识点#xff0c;掌握本教程相关知识后你就就可以快速掌握一些 U…视频链接https://www.bilibili.com/video/BV1wT9rYZEKe?spm_id_from333.788.videopod.sectionsvd_source25b783f5f945c4507229e9dec657b5bb本教程涉及到 Unity 常用组件、常用方法等核心知识点掌握本教程相关知识后你就就可以快速掌握一些 Unity2D 常用组件了1.需求分析玩家通过点击屏幕上的向左、向右移动按钮控制红色小车左右移动避让黄色小车黄色小车在屏幕最上方随机生成后向下移动屏幕右上方分数跟随时间变化而变化红色小车与某一辆黄色小车碰撞则游戏结束弹出游戏结束界面游戏结束界面上有本局游戏分数以及重新开始的按钮2.代码实现2.1 创建项目目录Imags静态图片Prefabs预设物体Resources动态资源Audio音频Scenes场景Scripts脚本2.2 创建面板、小车、按钮等2.3 按钮控制红色小车左右移动创建游戏管理脚本 GameManager.csusingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;publicclassGameManager:MonoBehaviour{/// summary/// 游戏管理器实例/// /summarypublicstaticGameManagerinsta;/// summary/// 主界面/// /summarypublicMainPanelmainPanel;privatevoidAwake(){instathis;}// Start is called before the first frame updatevoidStart(){}// Update is called once per framevoidUpdate(){}}红色小车挂载脚本 RedCar.csusingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;publicclassRedCar:MonoBehaviour{/// summary/// 移动速度/// /summaryprivateintmoveSpeed100;/// summary/// 移动方向/// /summarypublicintmoveDirection0;// Start is called before the first frame updatevoidStart(){}// Update is called once per framevoidUpdate(){//屏幕范围内左右移动if(moveDirection-1transform.localPosition.x-490)return;if(moveDirection1transform.localPosition.x490)return;transform.localPositionnewVector3(moveDirection*moveSpeed*Time.deltaTime,0,0);}/// summary/// 碰撞显示结束界面/// /summary/// param namecollision/paramprivatevoidOnTriggerEnter2D(Collider2Dcollision){GameManager.insta.overPanel.ShowPanel();}}主界面挂载脚本 MainPanel.cs拖拽相应物体usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;usingUnityEngine.UI;publicclassMainPanel:MonoBehaviour{/// summary/// 红色小车物体/// /summarypublicRedCarredCar;/// summary/// 分数文本/// /summarypublicTextscoreText;// Start is called before the first frame updatevoidStart(){}// Update is called once per framevoidUpdate(){}/// summary/// 点击按钮向左移动/// /summarypublicvoidOnLeftMoveClick(){redCar.moveDirection-1;}/// summary/// 点击按钮向右移动/// /summarypublicvoidOnRightMoveClick(){redCar.moveDirection1;}}2.4 黄色小车自动向下移动黄色小车挂载脚本 YellowCar.csusingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;publicclassYellowCar:MonoBehaviour{/// summary/// 移动速度/// /summaryprivateintmoveSpeed100;// Start is called before the first frame updatevoidStart(){}// Update is called once per framevoidUpdate(){transform.localPosition-newVector3(0,moveSpeed*Time.deltaTime,0);//向下移动if(transform.localPosition.y-1060)Destroy(gameObject);//如果移动到屏幕最底端则自动销毁}}2.5 红色小车与黄色小车碰撞则游戏结束红色小车挂载组件 Box Collider 2D 和 Rigidbody 2D黄色小车挂载组件 Box Collider 2D结束界面挂载脚本 OverPanel.csusingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;usingUnityEngine.SceneManagement;usingUnityEngine.UI;publicclassOverPanel:MonoBehaviour{/// summary/// 分数文本/// /summarypublicTextscoreText;// Start is called before the first frame updatevoidStart(){}// Update is called once per framevoidUpdate(){}/// summary/// 显示面板/// /summarypublicvoidShowPanel(){Time.timeScale0f;//游戏暂停gameObject.SetActive(true);}/// summary/// 点击按钮重新开始游戏/// /summarypublicvoidOnRestartClick(){Time.timeScale1f;//游戏恢复gameObject.SetActive(false);SceneManager.LoadScene(0);}}GameManager.cs 新增结束界面变量publicclassGameManager:MonoBehaviour{/// summary/// 游戏管理器实例/// /summarypublicstaticGameManagerinsta;/// summary/// 主界面/// /summarypublicMainPanelmainPanel;/// summary/// 结束界面/// /summarypublicOverPaneloverPanel;...2.6 更新界面分数主界面...publicclassMainPanel:MonoBehaviour{/// summary/// 红色小车物体/// /summarypublicRedCarredCar;/// summary/// 分数文本/// /summarypublicTextscoreText;/// summary/// 分数数值/// /summarypublicintscore;/// summary/// 开始时间/// /summaryprivatefloatstartTime;// Start is called before the first frame updatevoidStart(){startTimeTime.time;}// Update is called once per framevoidUpdate(){//更新分数score(int)(Time.time-startTime);scoreText.text分数score;}...结束界面...publicclassOverPanel:MonoBehaviour{/// summary/// 分数文本/// /summarypublicTextscoreText;// Start is called before the first frame updatevoidStart(){}// Update is called once per framevoidUpdate(){scoreText.text分数GameManager.insta.mainPanel.score;}...2.7 通过预设随机生成黄色小车创建黄色小车根目录.../// summary/// 创建黄色小车上一次时间/// /summaryprivatefloatlastTime;/// summary/// 黄色小车物体预设/// /summarypublicGameObjectpreYellowCarGo;/// summary/// 黄色小车根目录/// /summarypublicGameObjectyellowCarRootGo;// Start is called before the first frame updatevoidStart(){startTimeTime.time;lastTimeTime.time;}// Update is called once per framevoidUpdate(){//更新分数score(int)(Time.time-startTime);scoreText.text分数score;//每过3秒生成一辆黄色小车if(Time.time-lastTime3f){CreateYellowCar();lastTimeTime.time;}}/// summary/// 点击按钮向左移动/// /summarypublicvoidOnLeftMoveClick(){redCar.moveDirection-1;}/// summary/// 点击按钮向右移动/// /summarypublicvoidOnRightMoveClick(){redCar.moveDirection1;}/// summary/// 创建黄色小车/// /summaryprivatevoidCreateYellowCar(){//在x坐标为-490到490之间随机生成黄色小车GameObjectyellowCarGoInstantiate(preYellowCarGo,yellowCarRootGo.transform);intrandomIntRandom.Range(-490,490);yellowCarGo.transform.localPositionnewVector3(randomInt,1060,0);}}2.8 添加音频创建游戏中音频物体.../// summary/// 黄色小车根目录/// /summarypublicGameObjectyellowCarRootGo;/// summary/// 游戏进行中音频/// /summarypublicAudioSourcegameInAudioSource;// Start is called before the first frame updatevoidStart(){startTimeTime.time;// 开始时间赋值lastTimeTime.time;// 创建黄色小车上一次时间赋值gameInAudioSource.Play();//播放游戏进行音乐}...创建游戏结束音频物体.../// summary/// 游戏技术音频/// /summarypublicAudioSourcegameOverAudioSource;.../// summary/// 显示面板/// /summarypublicvoidShowPanel(){Time.timeScale0f;//游戏暂停gameObject.SetActive(true);//停止游戏进行音频播放游戏结束音频if(GameManager.insta.mainPanel.gameInAudioSource.isPlaying){GameManager.insta.mainPanel.gameInAudioSource.Stop();}gameOverAudioSource.Play();}...2.9 物体换皮3.完整代码GameManagerusingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;publicclassGameManager:MonoBehaviour{/// summary/// 游戏管理器实例/// /summarypublicstaticGameManagerinsta;/// summary/// 主界面/// /summarypublicMainPanelmainPanel;/// summary/// 结束界面/// /summarypublicOverPaneloverPanel;privatevoidAwake(){instathis;}// Start is called before the first frame updatevoidStart(){}// Update is called once per framevoidUpdate(){}}MainPanelusingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;usingUnityEngine.UI;publicclassMainPanel:MonoBehaviour{/// summary/// 红色小车物体/// /summarypublicRedCarredCar;/// summary/// 分数文本/// /summarypublicTextscoreText;/// summary/// 分数数值/// /summarypublicintscore;/// summary/// 开始时间/// /summaryprivatefloatstartTime;/// summary/// 创建黄色小车上一次时间/// /summaryprivatefloatlastTime;/// summary/// 黄色小车物体预设/// /summarypublicGameObjectpreYellowCarGo;/// summary/// 黄色小车根目录/// /summarypublicGameObjectyellowCarRootGo;/// summary/// 游戏进行中音频/// /summarypublicAudioSourcegameInAudioSource;// Start is called before the first frame updatevoidStart(){startTimeTime.time;// 开始时间赋值lastTimeTime.time;// 创建黄色小车上一次时间赋值gameInAudioSource.Play();//播放游戏进行音乐}// Update is called once per framevoidUpdate(){//更新分数score(int)(Time.time-startTime);scoreText.text分数score;//每过3秒生成一辆黄色小车if(Time.time-lastTime3f){CreateYellowCar();lastTimeTime.time;}}/// summary/// 点击按钮向左移动/// /summarypublicvoidOnLeftMoveClick(){redCar.moveDirection-1;}/// summary/// 点击按钮向右移动/// /summarypublicvoidOnRightMoveClick(){redCar.moveDirection1;}/// summary/// 创建黄色小车/// /summaryprivatevoidCreateYellowCar(){//在x坐标为-490到490之间随机生成黄色小车GameObjectyellowCarGoInstantiate(preYellowCarGo,yellowCarRootGo.transform);intrandomIntRandom.Range(-490,490);yellowCarGo.transform.localPositionnewVector3(randomInt,1060,0);}}OverPanelusingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;usingUnityEngine.SceneManagement;usingUnityEngine.UI;publicclassOverPanel:MonoBehaviour{/// summary/// 分数文本/// /summarypublicTextscoreText;/// summary/// 游戏技术音频/// /summarypublicAudioSourcegameOverAudioSource;// Start is called before the first frame updatevoidStart(){}// Update is called once per framevoidUpdate(){scoreText.text分数GameManager.insta.mainPanel.score;}/// summary/// 显示面板/// /summarypublicvoidShowPanel(){Time.timeScale0f;//游戏暂停gameObject.SetActive(true);//停止游戏进行音频播放游戏结束音频if(GameManager.insta.mainPanel.gameInAudioSource.isPlaying){GameManager.insta.mainPanel.gameInAudioSource.Stop();}gameOverAudioSource.Play();}/// summary/// 点击按钮重新开始游戏/// /summarypublicvoidOnRestartClick(){Time.timeScale1f;//游戏恢复gameObject.SetActive(false);SceneManager.LoadScene(0);}}RedCarusingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;publicclassRedCar:MonoBehaviour{/// summary/// 移动速度/// /summaryprivateintmoveSpeed100;/// summary/// 移动方向/// /summarypublicintmoveDirection0;// Start is called before the first frame updatevoidStart(){}// Update is called once per framevoidUpdate(){//屏幕范围内左右移动if(moveDirection-1transform.localPosition.x-490)return;if(moveDirection1transform.localPosition.x490)return;transform.localPositionnewVector3(moveDirection*moveSpeed*Time.deltaTime,0,0);}/// summary/// 碰撞显示结束界面/// /summary/// param namecollision/paramprivatevoidOnTriggerEnter2D(Collider2Dcollision){GameManager.insta.overPanel.ShowPanel();}}YellowCarusingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;publicclassYellowCar:MonoBehaviour{/// summary/// 移动速度/// /summaryprivateintmoveSpeed100;// Start is called before the first frame updatevoidStart(){}// Update is called once per framevoidUpdate(){transform.localPosition-newVector3(0,moveSpeed*Time.deltaTime,0);//向下移动if(transform.localPosition.y-1060)Destroy(gameObject);//如果移动到屏幕最底端则自动销毁}}
版权声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

长沙公司网站建立深圳做官网的公司

在一二年级的课堂上,就能看到不少孩子鼻梁上架着小眼镜;小区里玩耍的孩子中,一半以上都带着近视镜,甚至有些幼儿园大班的孩子,已经需要借助眼镜才能看清远处的滑梯。相关数据显示,我国青少年近视率持续攀升…

张小明 2026/3/11 16:27:43 网站建设

wordpress 全站备份南山建网站公司

8个降AI率工具推荐,研究生高效避坑指南 AI降重工具:研究生论文的高效避坑利器 随着人工智能技术的广泛应用,越来越多的研究生在撰写论文时面临一个共同的问题——如何降低AIGC率,避免被系统检测出AI痕迹。尤其是在学术论文中&…

张小明 2026/3/11 13:49:44 网站建设

wordpress多站点设置南京网站定制开发

Unity游戏实时翻译插件:XUnity.AutoTranslator完整使用指南 【免费下载链接】XUnity.AutoTranslator 项目地址: https://gitcode.com/gh_mirrors/xu/XUnity.AutoTranslator 面对精美的日系角色扮演游戏或欧美独立作品,语言障碍往往成为沉浸体验的…

张小明 2026/3/11 12:55:15 网站建设

资兴做网站公司网站服务器重启

云原生网关Higress与Istio深度整合:构建端到端流量治理体系的完整指南 【免费下载链接】higress Next-generation Cloud Native Gateway | 下一代云原生网关 项目地址: https://gitcode.com/GitHub_Trending/hi/higress 在微服务架构日益复杂的今天&#xff…

张小明 2026/3/11 16:48:12 网站建设

橙色可以做哪些网站易点科技网站建设

AJ-Report大屏设计终极指南:从零开始构建专业数据可视化平台 【免费下载链接】report AJ-Report是一个完全开源,拖拽编辑的可视化设计工具。三步快速完成大屏:配置数据源---->写SQL配置数据集---->拖拽生成大屏。让管理层随时随地掌控业…

张小明 2026/3/8 20:21:46 网站建设

金融公司网站建设模板财务公司代理记账业务

Wan2.2-T2V-A14B与YOLOv8结合?探索多模态AI在视频生成中的新边界 你有没有想过,未来某天只需输入一段文字——比如“一只红色狐狸在雪地中奔跑,穿过松树林,阳光斑驳洒落”——系统就能自动生成一段流畅、高清、细节真实的3秒短视频…

张小明 2026/3/9 4:15:49 网站建设