Commit db1b263f authored by 16이상민's avatar 16이상민

Write a test for the class "InputManager"

parent f7a0414a
...@@ -38,7 +38,7 @@ RenderSettings: ...@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1 m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0} m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0} m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1} m_IndirectSpecularColor: {r: 0.37311992, g: 0.38074034, b: 0.35872713, a: 1}
--- !u!157 &3 --- !u!157 &3
LightmapSettings: LightmapSettings:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -1346,6 +1346,7 @@ GameObject: ...@@ -1346,6 +1346,7 @@ GameObject:
- component: {fileID: 750753106} - component: {fileID: 750753106}
- component: {fileID: 750753107} - component: {fileID: 750753107}
- component: {fileID: 750753108} - component: {fileID: 750753108}
- component: {fileID: 750753109}
m_Layer: 5 m_Layer: 5
m_Name: InGameManagers m_Name: InGameManagers
m_TagString: Untagged m_TagString: Untagged
...@@ -1427,6 +1428,17 @@ MonoBehaviour: ...@@ -1427,6 +1428,17 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 397b5aecede4d754abd2fba781e08f97, type: 3} m_Script: {fileID: 11500000, guid: 397b5aecede4d754abd2fba781e08f97, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
--- !u!114 &750753109
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 750753102}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ef433fec09662034988a41dd58bf8b48, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &765048384 --- !u!1 &765048384
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
using UnityEngine;
public class ButtonStatus : MonoBehaviour
{
InputManager Manager;
// Use this for initialization
void Start ()
{
Manager = transform.GetComponent<InputManager>();
}
// Update is called once per frame
void Update ()
{
Manager.IsButtonDown = Input.GetKey(KeyCode.Space) ||
Input.GetKey(KeyCode.Joystick1Button0);
}
}
fileFormatVersion: 2 fileFormatVersion: 2
guid: 80c0267e119acbf45a7e4a2f7da153c0 guid: ef433fec09662034988a41dd58bf8b48
timeCreated: 1517759155 timeCreated: 1517984561
licenseType: Free licenseType: Free
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
......
...@@ -5,13 +5,17 @@ using UnityEngine; ...@@ -5,13 +5,17 @@ using UnityEngine;
public class InputManager : MonoBehaviour public class InputManager : MonoBehaviour
{ {
private bool IsButtonDownPrev { get; set; } private bool IsButtonDownPrev
private bool IsButtonDown { get; set; } { get; set; }
public bool IsButtonDown
{ private get; set; }
private MotionState PrevMotionState { get; set; } private MotionState PrevMotionState
public MotionState CurrentMotionState { private get; set; } { get; set; }
public MotionState CurrentMotionState
{ private get; set; }
public InputStatus ShortButtonStat public InputStatus ShortButtonStat
{ {
get get
{ {
...@@ -22,7 +26,7 @@ public class InputManager : MonoBehaviour ...@@ -22,7 +26,7 @@ public class InputManager : MonoBehaviour
} }
} }
public InputStatus LongButtonStat public InputStatus LongButtonStat
{ {
get get
{ {
...@@ -39,7 +43,7 @@ public class InputManager : MonoBehaviour ...@@ -39,7 +43,7 @@ public class InputManager : MonoBehaviour
} }
} }
public InputStatus ShortMotionStat public InputStatus ShortMotionStat
{ {
get get
{ {
...@@ -64,7 +68,7 @@ public class InputManager : MonoBehaviour ...@@ -64,7 +68,7 @@ public class InputManager : MonoBehaviour
} }
} }
public InputStatus LongMotionStat public InputStatus LongMotionStat
{ {
get get
{ {
...@@ -94,8 +98,6 @@ public class InputManager : MonoBehaviour ...@@ -94,8 +98,6 @@ public class InputManager : MonoBehaviour
{ {
IsButtonDownPrev = IsButtonDown; IsButtonDownPrev = IsButtonDown;
PrevMotionState = CurrentMotionState; PrevMotionState = CurrentMotionState;
IsButtonDown = ButtonStatusGetter.IsButtonDown;
} }
public InputStatus MotionToInput(string name, string type) public InputStatus MotionToInput(string name, string type)
......
This diff is collapsed.
using UnityEngine;
namespace StatusConvert
{
public static class ButtonStatusGetter
{
public static bool IsButtonDown
{
get
{
return Input.GetKey(KeyCode.Space) ||
Input.GetKey(KeyCode.Joystick1Button0);
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment