Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with the movement and the AdjustCameraHeight, I am new to this and need some help. This is on Unity 1.12, I only

I need help with the movement and the AdjustCameraHeight, I am new to this and need some help. This is on Unity 1.12, I only need help on the areas labeled with your work goes here. Thank you. I need code.

using System; using System.Collections; using System.Collections.Generic; using UnityEngine;

public class Player : MonoBehaviour { ///

/// MoveValue is available in the inspector and /// allows the user (player) to adjust how much /// to move which each Left or Right arrow. /// DO NOT CHANGE THIS CODE /// [Header("Move Value allows you to adjust the movement amount")] public float MoveValue = .5f;

// Start is called before the first frame update /// DO NOT CHANGE THIS CODE void Start() {

}

private bool ShiftKeyDown = false;

///

/// DO NOT MODIFY THE CODE within the Update Block /// Only make changes in the MoveDown,MoveUp, MoveLeft, /// MoveRight and AdjustCameraHeight methods. /// The key strokes will be make the cube move /// along the X-axis and the Y-axis. /// void Update() { if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) ShiftKeyDown = true; else if (!(Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))) ShiftKeyDown = false;

if (ShiftKeyDown) { if (Input.GetKeyDown(KeyCode.W)) { AdjustCameraHeight(MoveValue); } else if (Input.GetKeyDown(KeyCode.S)) { AdjustCameraHeight(-MoveValue); } } else { if (Input.GetKeyDown(KeyCode.A)) MoveLeft(); else if (Input.GetKeyDown(KeyCode.D)) MoveRight(); else if (Input.GetKeyDown(KeyCode.W)) { MoveUp(); } else if (Input.GetKeyDown(KeyCode.S)) { MoveDown(); } }

}

///

/// DO NOT CHANGE LINE 63 /// Move the camera position height value by the /// parameter AdjustY. /// The camera can be referenced by all scripts using /// Camera.main. /// Camera.main has a transform property as with all /// other GameObjects. /// /// The amount to adjust the Y value of the /// camera transform position public void AdjustCameraHeight(float AdjustY) { // YOUR WORK GOES HERE }

///

/// DO NOT CHANGE LINE 80 /// Use the correct instruction(s) /// to move the Cube down /// along the Y-Axis /// by the value of the /// public parameter field MoveValue /// IMPORTANT: This method MUST be public ///

public void MoveDown() { // YOUR WORK GOES HERE }

///

/// DO NOT CHANGE LINE 98 /// Use the correct instruction(s) /// to move the Cube up /// along the Y-Axis /// by the value of the /// public parameter field MoveValue /// IMPORTANT: This method MUST be public ///

public void MoveUp() {

}

///

/// DO NOT CHANGE LINE 115 /// Use the correct instruction(s) /// to move the Cube to the Left /// along the X-Axis /// by the value of /// the public parameter field MoveValue /// IMPORTANT: This method MUST be public /// public void MoveLeft() { // YOUR WORK GOES HERE

}

///

/// DO NOT CHANGE LINE 132 /// Use the correct instruction(s) /// to move the Cube to the Right /// along the X-axis /// by the value of /// the public parameter field MoveValue /// IMPORTANT: This method MUST be public ///

public void MoveRight() { // YOUR WORK GOES HERE

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago