当前位置:天才代写 > 其他代写 > CS代写:C#(C sharp) 课程编号:31263 / 32004 Game Programming Lab Week 2

CS代写:C#(C sharp) 课程编号:31263 / 32004 Game Programming Lab Week 2

2018-08-07 08:00 星期二 所属: 其他代写 浏览:767

31263 / 32004 Game Programming

Lab Week 2

 

Getting Started

1. Download the corresponding week’s zip file from the Lab section of UTSOnline.

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.

Tasks

 

Points

Requirements

40%

· Open the project folder in Unity. This is similar to the solution from last week so it should look familiar. Open Week2Scene if it is not already open.

· Create an empty GameObject from the GameObject menu and call it “ParentObj” and set clear its position and rotation by selecting the gear icon of the Transform component and clicking “Reset”.

· Apply the PrintAndHide component to the ParentObj instance and change the tag to “Red”.

50% (P)

· Create a Cube primitive from the GameObject menu.

· Scale it to (1.5,0.75,1), reset the position and rotation, and apply the RedMaterial to it.

· Add the cube as a child of ParentObj by dragging it onto the ParentObj in the Hierarchy Window.

· Associate the cube’s Renderer with the ParentObj’s PrintAndHide.rend variable in the Inspector Window.

· Update the prefab reference of RedPrefab in the Project Window so that the prefab has this parent-child relationship. Do this by dragging ParentObj in the Hierarchy Window to RedPrefab in the ProjectWindow and accepting any warning.

· Do the same for the BluePrefab by changing the cube’s material to BlueMaterial, the tag Blue, and replacing the BluePrefab in the Project Window.

· Delete the ParentObj and its child from the Hierarchy Window.

60% (P)

· Modify the LoadAssets script so that when redObj is initiated it is placed at (2,1,0) and the blueObj is at (-2,-1,0).

· Create a new C# script called InputManager and attach it to the MainCamera.

· In InputManager, make a private member variable that is an array of Transforms called “transArray”.


 

· When the game starts this script should:

Declare transAray as an array of size 2.

Assign the Transform components of redPrefab and bluePrefab to this array (tip: search GameObject.FindWithTag(…))

· Important: InputManager should do its starting actions in Start() and LoadAssets should do its starting actions in Awake(). Consider why this is and take note of it!

70% (C)

· In Update() of InputManager, detect whether the player has pressed the “W” (tip: see Input.GetKeyDown(…))

o When pressed, the redObj should be rotated by 45 degree around the z-axis and

the blueObj by -45 degrees around the z-axis. (tip: Search Transform.Rotate(…))

80% (D)

· Go to “Edit->Project Settings->Input” and edit the Fire1 axes to be bound to the “Q” key.

· In Update() of InputManager, detect whether the player has pressed the Fire key (tip: see Input.GetButtonDown(…))

When pressed, the redObj and blueObj should swap their vertical positions but keep their horizontal positions. (tip: search Transform.position)

This flip-flopping should happen every time Fire1 is pressed and should

regardless of what their starting position are.

90% (HD)

· In InputManager, when the Fire1 key is released:

Get the rend variable from the PrintAndHide component on the redObj. Change the color to be a random value between (51.0,0.0,0.0) and (255.0,0.0,0.0). (tip: see Transform.GetComponent<>(), Material.color, and the class Color – note that new Color(…) takes values between 0.0f and 1.0f for standard colors).

Repeat for blueObj but for the range (0.0,0.0,51.0) and (0.0,0.0,255.0).

Print both of these new values to the console in the form “Red: statement.

· In PrintAndHide, comment out all the console printing.

100% (HD)

· In InputManager, when the “E” key is pressed:

o If redObj and blueObj have a PrintAndHide component, then remove it.

o If redObj and blueObj do not have a PrintAndHide component, then add it and ensure that the gameobject it is added to is active.

· In PrintAndHide, when the component is added, it should:

o Assign the rend variable if it is not already assigned.

o Ensure that the renderer referenced by rend is enabled.

· Pressing play, then “E”, then “Q” will cause a NullReferenceException error in the console

o Prevent the error such that pressing Play, “E”, then “Q” will still swap the vertical positions of the cubes but not change the cube colors.

· CLEAN, EFFICIENT, ELEGANT CODE!

 

Submission

You must show your work to your tutor in this lab OR the start of the next lab in order for it to be graded.

代写CS&Finance|建模|代码|系统|报告|考试

编程类:C代写,JAVA代写 ,数据库代写,WEB代写,Python代写,Matlab代写,GO语言,R代写

金融类统计,计量,风险投资,金融工程,R语言,Python语言,Matlab,建立模型,数据分析,数据处理

服务类:Lab/Assignment/Project/Course/Qzui/Midterm/Final/Exam/Test帮助代写代考辅导

天才写手,代写CS,代写finance,代写statistics,考试助攻

E-mail:850190831@qq.com   微信:BadGeniuscs  工作时间:无休息工作日-早上8点到凌晨3点


如果您用的手机请先保存二维码到手机里面,识别图中二维码。如果用电脑,直接掏出手机果断扫描。

1513067809116994.png

 

    关键字:

天才代写-代写联系方式