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

家居网站建设 百度文库/爱站网长尾关键词挖掘

家居网站建设 百度文库,爱站网长尾关键词挖掘,帮人做ppt的网站,杨陵区住房和城乡建设局网站本身也具有一些unity知识,包括Eidtor界面使用、Shader效果实现、性能分析,但对C#、游戏逻辑不太清楚,这次想从开发者角度理解游戏,提高C#编程,从简单的unity游戏理解游戏逻辑,更好的为工作服务。 unity201…

本身也具有一些unity知识,包括Eidtor界面使用、Shader效果实现、性能分析,但对C#、游戏逻辑不太清楚,这次想从开发者角度理解游戏,提高C#编程,从简单的unity游戏理解游戏逻辑,更好的为工作服务。

unity2019.4.40f1c1,使用Unity官网FPS Microgame(如下图)。原本想从游戏源码启动流程开始学习,但Unity核心代码没有开源,就还是先理解游戏逻辑。

游戏分成 5个Scene,我们关注MainScene,其中有个GameManager,从Inspector看挂有许多Scripts,我们先一个个分析。

 GameFlowManager,引用using UnityEngine.SceneManagement,定义类GameFlowManager前半部分是在自定义Eidtor界面,这里float timeRatio = 1 - (m_TimeLoadEndGameScene - Time.time) / endSceneLoadDelay;不是很理解,待续

using UnityEngine;
using UnityEngine.SceneManagement;public class GameFlowManager : MonoBehaviour
{[Header("Parameters")][Tooltip("Duration of the fade-to-black at the end of the game")]public float endSceneLoadDelay = 3f;[Tooltip("The canvas group of the fade-to-black screen")]public CanvasGroup endGameFadeCanvasGroup;[Header("Win")][Tooltip("This string has to be the name of the scene you want to load when winning")]public string winSceneName = "WinScene";[Tooltip("Duration of delay before the fade-to-black, if winning")]public float delayBeforeFadeToBlack = 4f;[Tooltip("Duration of delay before the win message")]public float delayBeforeWinMessage = 2f;[Tooltip("Sound played on win")]public AudioClip victorySound;[Tooltip("Prefab for the win game message")]public GameObject WinGameMessagePrefab;[Header("Lose")][Tooltip("This string has to be the name of the scene you want to load when losing")]public string loseSceneName = "LoseScene";public bool gameIsEnding { get; private set; }PlayerCharacterController m_Player;NotificationHUDManager m_NotificationHUDManager;ObjectiveManager m_ObjectiveManager;float m_TimeLoadEndGameScene;string m_SceneToLoad;void Start(){   Debug.Log("Start Game: " + m_Player);//返回场景中的所填类型的随机个体m_Player = FindObjectOfType<PlayerCharacterController>();//DebugUtility.cs不是Unity中的内置脚本,存在Assets/FPS/Scripts/DebugUtility.csDebugUtility.HandleErrorIfNullFindObject<PlayerCharacterController, GameFlowManager>(m_Player, this);m_ObjectiveManager = FindObjectOfType<ObjectiveManager>();DebugUtility.HandleErrorIfNullFindObject<ObjectiveManager, GameFlowManager>(m_ObjectiveManager, this);AudioUtility.SetMasterVolume(1);}void Update(){if (gameIsEnding){   Debug.Log("m_TimeLoadEndGameScene: " + m_TimeLoadEndGameScene);Debug.Log("Time.time: " + Time.time);Debug.Log("endSceneLoadDelay: " + endSceneLoadDelay);float timeRatio = 1 - (m_TimeLoadEndGameScene - Time.time) / endSceneLoadDelay;Debug.Log("timeRatio: " + timeRatio);endGameFadeCanvasGroup.alpha = timeRatio;AudioUtility.SetMasterVolume(1 - timeRatio);// See if it's time to load the  (after the delay)if (Time.time >= m_TimeLoadEndGameScene){Debug.Log("Scene loading: " + m_SceneToLoad);SceneManager.LoadScene(m_SceneToLoad);gameIsEnding = false;}}else{if (m_ObjectiveManager.AreAllObjectivesCompleted())EndGame(true);// Test if player diedif (m_Player.isDead)EndGame(false);}}void EndGame(bool win){// unlocks the cursor before leaving the scene, to be able to click buttonsCursor.lockState = CursorLockMode.None;Cursor.visible = true;// Remember that we need to load the appropriate end scene after a delaygameIsEnding = true;endGameFadeCanvasGroup.gameObject.SetActive(true);if (win){m_SceneToLoad = winSceneName;m_TimeLoadEndGameScene = Time.time + endSceneLoadDelay + delayBeforeFadeToBlack;// play a sound on winvar audioSource = gameObject.AddComponent<AudioSource>();audioSource.clip = victorySound;audioSource.playOnAwake = false;audioSource.outputAudioMixerGroup = AudioUtility.GetAudioGroup(AudioUtility.AudioGroups.HUDVictory);audioSource.PlayScheduled(AudioSettings.dspTime + delayBeforeWinMessage);// create a game messagevar message = Instantiate(WinGameMessagePrefab).GetComponent<DisplayMessage>();if (message){message.delayBeforeShowing = delayBeforeWinMessage;message.GetComponent<Transform>().SetAsLastSibling();}}else{m_SceneToLoad = loseSceneName;m_TimeLoadEndGameScene = Time.time + endSceneLoadDelay;}}
}

http://www.fp688.cn/news/390.html

相关文章:

  • ps ui做响应式网站要求/seo研究中心好客站
  • 云南网站定制/网站关键词推广价格
  • 外地公司做的网站能备案吗/seo资源网站 排名
  • 宁国新站seo/互联网论坛
  • 网站建设策划方案书论文/营销宝
  • 深圳发型网站建设/百度点击软件还有用吗
  • 做淘客的网站关键词有哪些/优化seo软件
  • 外贸 需要到国外建网站吗/p站关键词排名
  • 网站要咋做/廊坊seo推广
  • 济宁网站开发平台/seo链接优化
  • 秦皇岛开发区建设局网站/安卓在线视频嗅探app
  • 哪些网站免费做职业测评/怎么建立企业网站
  • 网站注册域名后怎么做/网站访问量统计工具
  • 小木桥建设网站/营销策划精准营销
  • asp网站建设公司/西安seo优化
  • 信用中国 网站 支持建设/搜索词热度查询
  • 小型门户网站建设硬件配置/媒体资源网官网
  • 拉萨工商做年检网站/蚂蚁链接bt链接
  • 个人做的网站可以收款/seo网站优化建议
  • 工商局网站怎么做股东实名认证/济南seo整站优化价格
  • 江西省楚天建设集团有限公司网站/it培训四个月骗局
  • 网页设计图片高清/seo刷关键词排名工具
  • php网站开发实例教程第九章/2345浏览器官网
  • 大良o2o网站建设/创建网站的公司
  • wordpress源码带数据/图片seo优化是什么意思
  • vs建设网站/百度谷歌seo优化
  • 网络教育网站如何做营销推广/seo优化sem推广
  • 跟有流量的网站做友情链接/seo排名赚靠谱吗
  • 公司网站建设与维护工作计划/网络舆情分析师
  • 四川建设人才培训网站/拉新人拿奖励的app