Browse Source

Add esc exit for AtomicMutant

Josh Engebretson 9 years ago
parent
commit
5174325097
1 changed files with 8 additions and 1 deletions
  1. 8 1
      AtomicMutant/CSharp/Resources/Components/CharacterExample.cs

+ 8 - 1
AtomicMutant/CSharp/Resources/Components/CharacterExample.cs

@@ -5,6 +5,13 @@ public class CharacterExample : CSComponent
 {
 {
     void Start()
     void Start()
     {
     {
+
+        SubscribeToEvent<KeyDownEvent>(e =>
+        {
+            if (e.Key == Constants.KEY_ESCAPE)
+                GetSubsystem<Engine>().Exit();
+        });
+
         Node objectNode = Scene.CreateChild("AtomicMutant");
         Node objectNode = Scene.CreateChild("AtomicMutant");
 
 
         objectNode.Scale = new Vector3(1.5f, 1.5f, 1.5f);
         objectNode.Scale = new Vector3(1.5f, 1.5f, 1.5f);
@@ -72,7 +79,7 @@ public class CharacterExample : CSComponent
         // Limit pitch
         // Limit pitch
         pitch = Clamp<float>(pitch, -80.0f, 80.0f);
         pitch = Clamp<float>(pitch, -80.0f, 80.0f);
 
 
-        // Set rotation already here so that it's updated every rendering frame instead of every physics frame        
+        // Set rotation already here so that it's updated every rendering frame instead of every physics frame
         character.Node.Rotation = Quaternion.FromAxisAngle(Vector3.Up, yaw);
         character.Node.Rotation = Quaternion.FromAxisAngle(Vector3.Up, yaw);
 
 
         if (input.GetKeyPress(Constants.KEY_F))
         if (input.GetKeyPress(Constants.KEY_F))