私の学校のプロジェクトであるのでUnity5を探しています。彼らは私にfpsゲームを作ろうと言っていました。カメラをQとEで回転させるfpsを作ろうとしましたが、マウスでカメラを動かすことはできません。マウスを入力したいときは、自分のfps文字を動かすことはできません。ここに私のコードは:すべてのどのように私はマウスでカメラのビューを1フレームでfpsで表示できますか5
using UnityEngine;
public class Player : MonoBehaviour {
private MazeCell currentCell;
private MazeDirection currentDirection;
public void SetLocation (MazeCell cell) {
if (currentCell != null) {
currentCell.OnPlayerExited();
}
currentCell = cell;
transform.localPosition = cell.transform.localPosition;
currentCell.OnPlayerEntered();
}
private void Move (MazeDirection direction) {
MazeCellEdge edge = currentCell.GetEdge(direction);
if (edge is MazePassage) {
SetLocation(edge.otherCell);
}
}
private void Look (MazeDirection direction) {
transform.localRotation = direction.ToRotation();
currentDirection = direction;
}
private void Update() {
if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow)) {
Move(currentDirection);
}
if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) {
Move(currentDirection.GetNextClockwise());
}
if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow)) {
Move(currentDirection.GetOpposite());
}
if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow)) {
Move(currentDirection.GetNextCounterclockwise());
}
if (Input.GetKeyDown(KeyCode.Q)) {
Look(currentDirection.GetNextCounterclockwise());
}
if (Input.GetKeyDown(KeyCode.E)) {
Look(currentDirection.GetNextClockwise());
}
}
}
を{...}}。それは物事をはるかに単純化する:D – MrSunshine
それから何???ミスター、私に教えてください –
sryはすぐに入力を押していたxD – MrSunshine