赞
踩
众所周知,植物大战僵尸非常好玩,所以我们来制作一款类似的,名字就叫Glitch Garden。
布置场景需要用到很多素材,这里我们在GitHub中找到一位老师的素材并把需要的导入到project面板中
顺便提一嘴,创建好保存各式文件的文件夹是至关重要的,这里我就创建了很多,如果不知道意思的话可以百度翻译查一下
这是第一个场景Splash Scene
canvas设置要改成1920 * 1080
Screen Match Mode改成shrink,防止分辨率改变导致画面变形
上述是对齐方式。
接下来我们进入下一个场景
这两个Text都要改成向右对齐,也是为了适应分辨率的改变
我们还要创建加载场景用的空对象Scene Loader,给它一个脚本
内容如下:
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- public class LevelLoader : MonoBehaviour
- {
- int currentSceneIndex;
- [SerializeField] int loadDelay = 3;
- private void Start()
- {
- currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
- if (currentSceneIndex == 0)
- {
- StartCoroutine(WaitForTime());
- }
- }
- IEnumerator WaitForTime()
- {
- yield return new WaitForSeconds(loadDelay); //使用协成延迟调用场景
- SceneManager.LoadScene(currentSceneIndex + 1);
- }
- public void LoadNextScene()
- {
- SceneManager.LoadScene(currentSceneIndex + 1);
- }
- }
然后再创建一个作为播放音乐的 Load Sound
然后把它们两个都做成prefab放在两个场景
然后放在bulid setting中的Scene in bulid
过了三秒后自动切换场景
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。