Created
September 12, 2018 02:24
-
-
Save iggyvolz/a9d390e2bd8d440ed0a56895a7305bda to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace CryEngine.Game | |
{ | |
[EntityComponent(Guid="8edf52be-45b8-d8f1-0cd5-e784c1abacd2")] | |
public class PlayerController : EntityComponent | |
{ | |
/// <summary> | |
/// Called at the start of the game. | |
/// </summary> | |
protected override void OnGameplayStart() | |
{ | |
} | |
/// <summary> | |
/// Called once every frame when the game is running. | |
/// </summary> | |
/// <param name="frameTime">The time difference between this and the previous frame.</param> | |
protected override void OnUpdate(float frameTime) | |
{ | |
base.OnUpdate(frameTime); | |
Vector3 pos = Entity.Position; | |
Log.Always("Old position: " + Entity.Position.ToString()); | |
if (Input.KeyDown(KeyId.Up)) | |
{ | |
Log.Always("Up key"); | |
pos += new Vector3(1, 0, 0); | |
} | |
else if(Input.KeyDown(KeyId.Down)) | |
{ | |
Log.Always("Down key"); | |
pos -= new Vector3(1, 0, 0); | |
} | |
Entity.Position = pos; | |
Log.Always("New position: " + Entity.Position.ToString()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment