首页 > 其他分享 >31263 / 32004 Game Development

31263 / 32004 Game Development

时间:2024-09-18 13:51:15浏览次数:1  
标签:Development called should Game TimeManager file time 32004 your

31263 / 32004 Game Development

Lab Week 6

Getting Started

1. Download the corresponding week’s zip file from this week’s module on Canvas.

2. Unzip the project folder and open it in Unity. If there are any warnings about difference in versions, just continue. If this causes any red errors in the console once the project opens, notify the tutor.

3. Within the weekly folders there are image and executable files starting with “Status…”. These files give you a preview of what is expected for each point percentage below.

a. If you are on Mac and the Status-100Percent App file won’t run, hold control and click (right click) then select Open, if there is a security warning, acknowledge it an press open again.

i. If you still have trouble, you may need to change the permissions of the file with the following command in a Terminal window: chmod -R +x Status-100Percent-Mac.app/Contents/MacOS

b. If you are running the Windows executable on the lab computers, you need to copy the entire executable folder into Windows(C:)/Users/<student number>/AppLockerExceptions.

From there you can double run the .exe file.

Tasks

Points                                                               Requirements

40%

• Open the project folder in Unity. Open Week6Scene if it is not already open.

• Create an empty GameObject called “Managers”.

• Open the TimeManager script. in the Scripts folder

• For every 1 second that passes, TimeManager should print the time since start of game as an integer seconds value.

o Tip: use a private member variable such as “int lastTime” to store the time value that was last printed. Then use Time.time in Update() to check if a full second has passed.

o Make sure that TimeManager starts printing from 0 (e.g. 0, 1, 2… etc).

▪ Tip: Consider an initial value of lastTime that would be overridden for Time.time = 0 in the first Update call.

• Attach TimeManager to the Managers gameobject.

There is no ProgressEvaluator for this week because it would give away the solutions to the activity. It is better for you to learn from a good challenge and check your own progress this week. Make sure you are looking at the Status-xPercent image files or ask your tutor to check your game is running as expected.

50% (P)

• In TimeManager, use Input.GetKeyDown(KeyCode) to detect when the Spacebar is pressed, which should do the following:

o Pause and unpause (tip: see Time.timeScale)

o Print to the console “Spacebar pressed”

o Note: Update() is still called but Time.time is no longer updated

60% (P)

• Instead of Time.time, change the code to use Time.deltaTime and a private variable called “timer”. Keep track of time by adding deltaTime to the timer (e.g. timer += Time.deltaTime;)

o The printing to console should still start from 0.

• On pressing the Enter (Return) key, the seconds timer should be reset to 0.

o The reset should take place in a new private method called ResetTime() to make this functionality easily re-usable. It should be called when the game starts and then whenever the Return key is pressed.

o ResetTime() should also reset all time related variables to their default values.

Reminder: Complete the COMPLETE-BEFORE-SUBMISSION.txt  代 写31263 / 32004 Game Developmentfile before you submit. Otherwise, you will receive a mark of 0 .

70% (C)

• From the Prefab folder in the Project Window:

o Drag a RedPrefab into the Hierarchy Window, make sure the rotation is zeroed and set the position to (2,1,0)

o Drag a BluePrefab into the Hierarchy Window, make sure the rotation is zeroed and set the position to (-2,-1,0)

• In TimeManager:

o Create a serialized private Transform. array called transformArray. Select the Managers gameobject in the Hierarchy Window and change the size of the transformArray in the Inspector Window to 2. Drag the RedPrefab and BluePrefab instances from the Hierarchy Window into the array.

o Create a c# “constant” float member variable called “moveWait” and set it to 2.0f.

• From the Start() method of the TimeManager

o Change the camera view from “perspective” to “orthographic” (tip: see Camera.main and Camera.orthographic).

o Set the orthographic size of the main camera to 2.5f.

80% (D)

• In TimeManager, create a new private method called MoveObjects()

o Once every <moveWait> seconds on the timer, move the colored objects in a synchronized square clockwise manner (e.g. when the timer prints out as 2 the RedPrefab should pop to (2,-1,0) and the BluePrefab to (-2,1,0), then move again at 4 seconds).

o Challenge: Can you make it so that this movement can account for any starting positions of the two objects but assuming that there are only two objects to move and that they start with different x and y values? (not required, only for a fun and useful challenge)

▪ Rotation in this case is not around (0,0), but such that the red and blue gameobjects will be in each other’s initial positions after two MoveObject calls.

90% (HD)

• Create another const float called “scaleWait” and set it to 4.0f.

• Create the private method “ScaleObjects()” which should do the following to the transformArray elements:

o If an object’s local x scale value is greater than 1.5 then divide all scale values by 1.2.

o Otherwise, multiply all scale values by 1.2.

o Tip: see Transform.localScale

• In ResetTime(), use InvokeRepeating(…) to call ScaleObjects() once every <scaleWait> seconds.

• This behavior. should obey the Pausing and Reset functionality (tip: see CancelInvoke(…))

100% (HD)

• When the “Escape” key is pressed, TimeManager should generate a random value between (0.5, 1.0) and start the following coroutine (tip: see StartCoroutine()).

o “IEnumerator RotateObjects(float randomDelay){…}”

• This coroutine should wait for <randomDelay> seconds, then rotate the two game objects by positive 90 degrees around the z axis, then repeat 3 more times (e.g. wait-rotate-wait-rotate and so on. The objects turn a full 360 degrees before exiting the method) (tip: see WaitForSeconds(…))

• This should obey the Pausing functionality but not the Reset functionality (i.e. the objects should finish their full rotation).

• Try the Status-100% executables

o Press Escape to start the rotation

o Press Spacebar to pause the movement, scaling, and rotation

o Press Spacebar to un-pause everything

▪ If you do this a few times and your objects are rapidly changing size (i.e. not at 4 second intervals) then you are stacking Invoke calls (multiple scale invokes are running at the same time) and you need to go back and check the 90% section.

o Press Escape again and then Enter to reset the timer for movement and scaling but the rotation should continue

▪ If you press Escape multiple times and your objects are no longer rotating at even intervals or are popping back a forth between rotations then you are stacking coroutine calls – only one rotation coroutine at a time should be running.

• CLEAN, EFFICIENT, ELEGANT CODE!

Bonus

Submit your work on Canvas before continuing. Follow the instructions on the last page.

This part is optional. If you completed the above activity very quickly, try this. It is not graded, but it will enhance your skill.

• Merge you Week 5 solution into your Week 6 solution (or use the provided Week 5 Solution on Canvas instead)

• Remove the Update() methods from all of the Week 5 and 6 scripts

o Replace them instead with Coroutines that are started in Awake or Start.

o See if you can change the content of these so that they do the same thing as the old Update methods but in a different way.

• Note: This is definitely not a recommended thing to do!

o Do not re-invent the wheel – Unity already has a game cycle, you don’t need to make your own (a mistake a lot of people make when they first master Coroutines)

o However, this is a good exercise to show you the power of Coroutines and how all Unity Update() methods are essentially just Coroutines.

Submission

When you complete the activity to the grade threshold that you want, you then need to:

1. Evaluate your progress:

a. Make sure that you have run the “ProgressEvaluator” at the final band you achieved.

b. Not doing so is an indication that you are not evaluating and tracking your own learning.

2. Complete the plagiarism declaration:

a. Complete the “COMPLETE-BEFORE-SUBMISSION.txt” file in the highest level of the project folder.

3. Reduce file size:

a. Remove all files and folders starting with the “Status-…” prefix

b. Remove the “Library” folder

4. Preparing your zip file:

a. Zip the entire project folder.

b. Re-name the zip file to “[student ID]-LabWeek[week number].zip”.

5. Submit the zip file to Canvas for the associated link for this week in the Lab before Monday 9am of the following week.

6. Failure to follow any of these could result in a 0% mark for that week.

 

标签:Development,called,should,Game,TimeManager,file,time,32004,your
From: https://www.cnblogs.com/qq---99515681/p/18418249

相关文章

  • 游戏创作的梦想之地!EE GAMES 创作者社区上线,VipSkill产学研结合迈开重大步伐
    EEGAMES官网EEGAMES创作者社区是一个怎样的平台?EEGAMES创作者社区,是专注于链接每一位游戏创作者,提供全方位服务的游戏领域垂类社区。这里不仅仅是一个游戏创作的互助平台,更是每一位游戏创作者的梦想启航之地!无论你是经验丰富的游戏研发行家,还是刚刚起步的业内新人,都可......
  • 通过NandGame网站学习逻辑门
    继电器:电磁继电器由电磁铁和衔铁组成,给电磁铁通电磁铁有磁性会把衔铁吸下来,那么再接上电路,就可以通过电磁铁控制电路开关。如下图所示,左图是电磁铁未接电的状态,左图是电磁铁已接电的状态。继电器是一种可由电流(称为控制电流)控制的开关。控制电流连接到一个磁铁,用于把连接端子......
  • 魔兽世界地心之战第一赛季开启,GameViewer远程助你随时随地手机玩魔兽世界
    “地心之战”第1赛季正式开启,本次11.0更新了地下堡玩法,地下堡是11.0新增的全新pve玩法,拥有海量奖励,想要获得奖励,每周的大小周常(1大4小)也非常重要,要给开地下堡丰裕宝箱的钥匙,地下堡解锁高层后,直接就能从丰裕宝箱开出603装备,低保给616装备(需要完成2次)。地下堡同时也是最适合孤......
  • 『功能项目』GameObject对象池 - 第三职业【39】
    本章项目成果展示我们打开上一篇38管理器基类的项目,本章要做的事情是利用对象池制作第三个职业——魔法师在GameRoot对象下创建空物体重命名为PoolRoot将GameRoot拖拽至预制体创建脚本:编写脚本:PoolManager.csusingUnityEngine;publicclassPoolManager:M......
  • 【五一省选集训day4】Grid Game
    【五一省选集训day4】GridGame首先发现\(n,m\le2000\),可以考虑枚举正方形左上端点\((x_0,y_0)\)。对于一个边长为\(len\)的合法的正方形,如果\(len=k\)这个正方形全黑,需要特判,否则它至少有一个白点。我们惊奇地发现,对于这样的其中一个白点,它所在的那一列一定存在恰好\(......
  • CF1991E Coloring Game 题解
    Description有一个由\(n\)个顶点和\(m\)条边组成的无向图。每个顶点可以用三种颜色之一着色:\(1\)、\(2\)或\(3\)。初始时,所有顶点都未着色。Alice和Bob正在玩一个包含\(n\)轮的游戏。在每一轮中,都会发生以下两个步骤:Alice选择两种不同的颜色。Bob选择一个未......
  • GAMES101(0~1作业)
    搭建虚拟机环境安装OracleVMVirtualBox虚拟机,安装虚拟硬盘,配置Linux Ubuntu-64bit系统,启动虚拟机,发生冲突错误:将Vmware虚拟设备取消挂起状态,关机确保Hyper-V完全关闭:bcdedit/sethypervisorlaunchtypeoff重启计算机安装增强功能,未找到iso错误:ISO下载地址:Indexof......
  • HDU 1729 Stone Game
    https://ac.nowcoder.com/acm/contest/34655/C有\(n\)个箱子,第\(i\)个箱子最多放\(s_i\)个石子,当前箱子里的石子数为\(c_i\)。两个人轮流往箱子里放石子,而且每一次放的数量都有限制:不能超过当前箱子内石子数的平方。例如箱子里有\(3\)颗石子,那么下一个人就可以放\(1-9\)......
  • 关于ybc_game库的用法(第一期)
    大家好,我是于翱睿,今天我给大家更新一期如何正确的使用ybc_game库,避免踩坑。首先,需要说的是:所有的图片必须放在images文件夹里,在代码中不用写“images/”同样,要想保存音频,所有的音频必须放在sounds文件夹中,在代码中不用写“sounds/”所有说明我都放到注释里了,注意仔细观察那......
  • 【转载】《扩散模型是实时游戏引擎(Diffusion Models Are Real-Time Game Engines)》的
    地址:https://www.youtube.com/watch?v=VniPJII6ak08月29号,谷歌DeepMind发布了一篇名为《扩散模型是实时游戏引擎(DiffusionModelsAreReal-TimeGameEngines)》的论文,向我们展示了世界上第一个完全由神经模型驱动的游戏引擎,GameNGen。这也是历史上首次,AI能在不借助其他......