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.
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
}
}