Browse Source

Merge branch 'master' of https://sphynx.bumblebeargames.com/josh/namedropper

combinedRaceAndNameDropper
Josh 2 years ago
parent
commit
a0c6db5866
  1. 3
      .gitignore
  2. 34
      namedropper/Assets/Join.cs
  3. 5
      namedropper/Assets/Scenes/Title.unity
  4. 17
      namedropper/Assets/Scripts/TopicSelect.cs
  5. 36
      namedropper/Assets/TrackballInputManager.cs

3
.gitignore

@ -0,0 +1,3 @@
rawinputdll/rawinputdll/.vs/rawinputdll/v17
rawinputdll/rawinputdll/UpgradeLog.htm
rawinputdll/rawinputdll/.vs/rawinputdll/project-colors.json

34
namedropper/Assets/Join.cs

@ -10,14 +10,23 @@ public class Join : MonoBehaviour
[SerializeField] List<KeyCode> _readyKeys = new List<KeyCode>(); [SerializeField] List<KeyCode> _readyKeys = new List<KeyCode>();
int _numPlayersReady = 0; int _numPlayersReady = 0;
public int NumPlayersReady { get => _numPlayersReady;
set
{
_numPlayersReady = value;
UpdateText();
}
}
void Start() void Start()
{ {
NumPlayersReady = 4;
UpdateText(); UpdateText();
} }
void UpdateText() void UpdateText()
{ {
_numPlayersReadyText.text = _numPlayersReady + " players ready"; _numPlayersReadyText.text = NumPlayersReady + " players ready";
} }
// Update is called once per frame // Update is called once per frame
void Update() void Update()
@ -28,7 +37,7 @@ public class Join : MonoBehaviour
if (Input.GetKeyDown(key)) if (Input.GetKeyDown(key))
{ {
keysToRemove.Add(key); keysToRemove.Add(key);
_numPlayersReady++; NumPlayersReady++;
UpdateText(); UpdateText();
} }
} }
@ -50,15 +59,30 @@ public class Join : MonoBehaviour
StartGame(); StartGame();
} }
if (Input.GetKeyDown(KeyCode.Alpha4)) if (Input.GetKeyDown(KeyCode.F1))
{
NumPlayersReady = 1;
}
if (Input.GetKeyDown(KeyCode.F2))
{
NumPlayersReady = 2;
}
if (Input.GetKeyDown(KeyCode.F3))
{
NumPlayersReady = 3;
}
if (Input.GetKeyDown(KeyCode.F4))
{ {
_numPlayersReady = 4; NumPlayersReady = 4;
} }
} }
void StartGame() void StartGame()
{ {
GameManager.Instance.NumPlayers = _numPlayersReady; GameManager.Instance.NumPlayers = NumPlayersReady;
SceneManager.LoadScene("TopicSelect"); SceneManager.LoadScene("TopicSelect");
} }
} }

5
namedropper/Assets/Scenes/Title.unity

@ -291,7 +291,7 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_text: 0 players ready m_text: 4 players ready
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 4fe6d5308385b4341885d0d510c8e2aa, type: 2} m_fontAsset: {fileID: 11400000, guid: 4fe6d5308385b4341885d0d510c8e2aa, type: 2}
m_sharedMaterial: {fileID: 1001970574707011636, guid: 4fe6d5308385b4341885d0d510c8e2aa, type: 2} m_sharedMaterial: {fileID: 1001970574707011636, guid: 4fe6d5308385b4341885d0d510c8e2aa, type: 2}
@ -833,8 +833,7 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_text: "\nPress Start to join\n\nPress 1 to start Co-op mode\n or 2 to start m_text: "\nPress 1 to start Co-op mode\n or 2 to start VS. mode"
VS. mode"
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 4fe6d5308385b4341885d0d510c8e2aa, type: 2} m_fontAsset: {fileID: 11400000, guid: 4fe6d5308385b4341885d0d510c8e2aa, type: 2}
m_sharedMaterial: {fileID: 1001970574707011636, guid: 4fe6d5308385b4341885d0d510c8e2aa, type: 2} m_sharedMaterial: {fileID: 1001970574707011636, guid: 4fe6d5308385b4341885d0d510c8e2aa, type: 2}

17
namedropper/Assets/Scripts/TopicSelect.cs

@ -113,6 +113,18 @@ public class TopicSelect : Level
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
if (Input.GetKeyDown(KeyCode.Alpha1))
{
PickTopic(_topic1Box);
}
else if (Input.GetKeyDown(KeyCode.Alpha2))
{
PickTopic(_topic2Box);
}
else if (Input.GetKeyDown(KeyCode.Alpha3))
{
PickTopic(_topic3Box);
}
} }
@ -162,6 +174,11 @@ public class TopicSelect : Level
void Results() void Results()
{ {
TopicBox topicBox = _picks[Random.Range(0, _picks.Count)]; TopicBox topicBox = _picks[Random.Range(0, _picks.Count)];
PickTopic(topicBox);
}
public static void PickTopic(TopicBox topicBox)
{
GameDataManager.Instance.CurrentTopic = topicBox.TopicData; GameDataManager.Instance.CurrentTopic = topicBox.TopicData;
SceneManager.LoadScene("Game"); SceneManager.LoadScene("Game");
} }

36
namedropper/Assets/TrackballInputManager.cs

@ -8,10 +8,10 @@ using UnityEngine.UI;
public class TrackballInputManager : MonoBehaviour public class TrackballInputManager : MonoBehaviour
{ {
const float defaultMiceSensitivity = 2f; const float defaultMiceSensitivity = 2.5f;
const float upMultiplier = .5f; const float upMultiplier = .5f;
const float accelerationThreshold = 40; const float accelerationThreshold = 120;
const float accelerationMultiplier = 2; const float accelerationMultiplier = .5f;
[DllImport("LibRawInput")] [DllImport("LibRawInput")]
private static extern bool init(); private static extern bool init();
@ -65,7 +65,25 @@ public class TrackballInputManager : MonoBehaviour
Cursor.lockState = CursorLockMode.Locked; Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false; Cursor.visible = false;
//josh's desktop devices
_ignoredDevices.Add(4468289); _ignoredDevices.Add(4468289);
//josh's laptop devices
_ignoredDevices.Add(75111393);
_ignoredDevices.Add(1265500329);
_ignoredDevices.Add(579863325);
_ignoredDevices.Add(1384081);
_ignoredDevices.Add(188554181);
_ignoredDevices.Add(1331371593);
_ignoredDevices.Add(1834746285);
_ignoredDevices.Add(170921507);
_ignoredDevices.Add(381291525);
_ignoredDevices.Add(254348147);
_ignoredDevices.Add(254282139);
} }
public void OnDestroy() public void OnDestroy()
@ -109,8 +127,16 @@ public class TrackballInputManager : MonoBehaviour
{ {
float dx = ev.x * defaultMiceSensitivity; float dx = ev.x * defaultMiceSensitivity;
float dy = ev.y * defaultMiceSensitivity; float dy = ev.y * defaultMiceSensitivity;
if (Mathf.Abs(dx) > accelerationThreshold) dx *= accelerationMultiplier; if (Mathf.Abs(dx) > accelerationThreshold)
if (Mathf.Abs(dy) > accelerationThreshold) dy *= accelerationMultiplier; {
print("hit acceleration threshold x");
dx *= accelerationMultiplier;
}
if (Mathf.Abs(dy) > accelerationThreshold)
{
print("hit acceleration threshold y");
dy *= accelerationMultiplier;
}
if (dy < 0) if (dy < 0)
dy *= upMultiplier; dy *= upMultiplier;

Loading…
Cancel
Save