Skip to content

Commit

Permalink
Merge branch 'master' into Upgrade-to-Unity-2019.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lux committed May 27, 2020
2 parents ecac912 + e2dfcc9 commit b2eda52
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Assets/VRKeys/Scripts/BackspaceKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ namespace VRKeys {
public class BackspaceKey : Key {

public override void HandleTriggerEnter (Collider other) {
PressKey ();
}

public override void PressKey () {
keyboard.Backspace ();

ActivateFor (0.3f);
base.PressKey ();
}

public override void UpdateLayout (Layout translation) {
Expand Down
4 changes: 4 additions & 0 deletions Assets/VRKeys/Scripts/CancelKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ namespace VRKeys {
public class CancelKey : Key {

public override void HandleTriggerEnter (Collider other) {
PressKey ();
}

public override void PressKey () {
keyboard.Cancel ();
}

Expand Down
6 changes: 5 additions & 1 deletion Assets/VRKeys/Scripts/ClearKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ namespace VRKeys {
public class ClearKey : Key {

public override void HandleTriggerEnter (Collider other) {
PressKey ();
}

public override void PressKey () {
keyboard.SetText ("");

ActivateFor (0.3f);
base.PressKey ();
}

public override void UpdateLayout (Layout translation) {
Expand Down
4 changes: 4 additions & 0 deletions Assets/VRKeys/Scripts/EnterKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ namespace VRKeys {
public class EnterKey : Key {

public override void HandleTriggerEnter (Collider other) {
PressKey ();
}

public override void PressKey () {
keyboard.Submit ();
}

Expand Down
7 changes: 7 additions & 0 deletions Assets/VRKeys/Scripts/Key.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ public void OnTriggerEnter (Collider other) {
}
}

/// <summary>
/// Manually trigger a key press.
/// </summary>
public virtual void PressKey () {
ActivateFor (0.3f);
}

private IEnumerator Press (Collider other, Mallet mallet) {
isPressing = true;

Expand Down
6 changes: 5 additions & 1 deletion Assets/VRKeys/Scripts/LetterKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ public string GetCharacter () {
}

public override void HandleTriggerEnter (Collider other) {
PressKey ();
}

public override void PressKey () {
keyboard.AddCharacter (GetCharacter ());

ActivateFor (0.3f);
base.PressKey ();
}
}
}
4 changes: 4 additions & 0 deletions Assets/VRKeys/Scripts/ShiftKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public class ShiftKey : Key {
private bool shifted = false;

public override void HandleTriggerEnter (Collider other) {
PressKey ();
}

public override void PressKey () {
keyboard.ToggleShift ();
}

Expand Down
6 changes: 5 additions & 1 deletion Assets/VRKeys/Scripts/SpaceKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ namespace VRKeys {
public class SpaceKey : Key {

public override void HandleTriggerEnter (Collider other) {
PressKey ();
}

public override void PressKey () {
keyboard.AddCharacter (" ");

ActivateFor (0.3f);
base.PressKey ();
}

public override void UpdateLayout (Layout translation) {
Expand Down

0 comments on commit b2eda52

Please sign in to comment.