Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1a9608d

Browse files
Start Manager
Started to add the start manager to the game
1 parent 8670448 commit 1a9608d

File tree

11 files changed

+1654
-2089
lines changed

11 files changed

+1654
-2089
lines changed

‎Native_Compilation_Project/Assets/Camera/Scripts/CameraShake.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class CameraShake : MonoBehaviour
1313

1414
public void Start()
1515
{
16-
cam = Camera.main;
16+
cam = GetComponent<Camera>();
1717
}
1818

1919
public void cameraShake(float length, float hardness)

‎Native_Compilation_Project/Assets/Input Systems/PlayerInputs.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,8 +618,24 @@ public @PlayerInputs()
618618
""devices"": [
619619
{
620620
""devicePath"": ""<Gamepad>"",
621+
""isOptional"": true,
622+
""isOR"": false
623+
}
624+
]
625+
},
626+
{
627+
""name"": ""K&M"",
628+
""bindingGroup"": ""K&M"",
629+
""devices"": [
630+
{
631+
""devicePath"": ""<Keyboard>"",
621632
""isOptional"": false,
622633
""isOR"": false
634+
},
635+
{
636+
""devicePath"": ""<Mouse>"",
637+
""isOptional"": true,
638+
""isOR"": false
623639
}
624640
]
625641
}
@@ -896,6 +912,15 @@ public InputControlScheme PvPScheme
896912
return asset.controlSchemes[m_PvPSchemeIndex];
897913
}
898914
}
915+
private int m_KMSchemeIndex = -1;
916+
public InputControlScheme KMScheme
917+
{
918+
get
919+
{
920+
if (m_KMSchemeIndex == -1) m_KMSchemeIndex = asset.FindControlSchemeIndex("K&M");
921+
return asset.controlSchemes[m_KMSchemeIndex];
922+
}
923+
}
899924
public interface IPlayer_MapActions
900925
{
901926
void OnMovement(InputAction.CallbackContext context);

‎Native_Compilation_Project/Assets/Input Systems/PlayerInputs.inputactions

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,24 @@
596596
"devices": [
597597
{
598598
"devicePath": "<Gamepad>",
599+
"isOptional": true,
600+
"isOR": false
601+
}
602+
]
603+
},
604+
{
605+
"name": "K&M",
606+
"bindingGroup": "K&M",
607+
"devices": [
608+
{
609+
"devicePath": "<Keyboard>",
599610
"isOptional": false,
600611
"isOR": false
612+
},
613+
{
614+
"devicePath": "<Mouse>",
615+
"isOptional": true,
616+
"isOR": false
601617
}
602618
]
603619
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using TMPro;
4+
using UnityEngine;
5+
6+
public class PvP_CountDownTimer : MonoBehaviour
7+
{
8+
public float totalTime = 5 * 60;
9+
public TMP_Text timerText;
10+
11+
// Update is called once per frame
12+
void Update()
13+
{
14+
totalTime -= Time.deltaTime;
15+
float minutes = Mathf.FloorToInt(totalTime / 60);
16+
float seconds = Mathf.FloorToInt(totalTime % 60);
17+
float milliSeconds = (totalTime % 1) * 1000;
18+
timerText.text = string.Format("{0:00}:{1:00}:{2:000}", minutes, seconds, milliSeconds);
19+
}
20+
}

‎Native_Compilation_Project/Assets/PvP/Scripts/PvP_CountDownTimer.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Native_Compilation_Project/Assets/PvP/Scripts/PvP_PlayerID.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ public class PvP_PlayerID : MonoBehaviour
1515
public PvP_PlayerManager manager;
1616
public PvP_WeaponManager weaponManager;
1717
public PvP_Health health;
18+
public PvP_StartManager startManager;
1819

1920
public void Start()
2021
{
2122
manager = GameObject.FindGameObjectWithTag("MANAGER").GetComponent<PvP_PlayerManager>();
23+
startManager = GameObject.FindGameObjectWithTag("PvP_UIManager").GetComponent<PvP_StartManager>();
2224
if (playerID == 1) // Player 1 (blue)
2325
{
2426
weaponManager = manager.P1.GetComponent<PvP_WeaponManager>();
@@ -39,6 +41,8 @@ public void Start()
3941
health.playerID = 0;
4042
// object color
4143
manager.P1.GetComponent<MeshRenderer>().material.color = Color.blue;
44+
// start manager P1
45+
startManager.p1JoinedGame();
4246
}
4347
else if (playerID == 2) // Player 2 (red)
4448
{
@@ -60,6 +64,8 @@ public void Start()
6064
health.playerID = 1;
6165
// object color
6266
manager.P2.GetComponent<MeshRenderer>().material.color = Color.red;
67+
// start manager P1
68+
startManager.p2JoinedGame();
6369
}
6470
}
6571
}

‎Native_Compilation_Project/Assets/PvP/Scripts/PvP_Shooting.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ public void ShootPressed()
307307
// REDOO THIS SO THAT IT WILL WORK WITH 2 CONTROLLERS
308308
public IEnumerator controllerShake()
309309
{
310-
Gamepad.current.SetMotorSpeeds(strength, strength);
310+
Gamepad.all[bulletID].SetMotorSpeeds(strength, strength);
311311
yield return new WaitForSeconds(shakeAmmount);
312-
Gamepad.current.ResetHaptics();
312+
Gamepad.all[bulletID].ResetHaptics();
313313
}
314314
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using TMPro;
4+
using UnityEngine;
5+
6+
public class PvP_StartManager : MonoBehaviour
7+
{
8+
public bool p1Joined;
9+
public bool p2Joined;
10+
11+
public GameObject p1waitingText;
12+
public GameObject p1pressAnyButton;
13+
public GameObject p1join;
14+
public GameObject p1ready;
15+
public GameObject p1confirm;
16+
17+
public GameObject p2waitingText;
18+
public GameObject p2pressAnyButton;
19+
public GameObject p2join;
20+
public GameObject p2ready;
21+
public GameObject p2confirm;
22+
23+
public void OnEnable()
24+
{
25+
Time.timeScale = 0f;
26+
}
27+
28+
public void p1JoinedGame()
29+
{
30+
p1Joined = true;
31+
p1waitingText.SetActive(false);
32+
p1pressAnyButton.SetActive(false);
33+
34+
p1join.SetActive(true);
35+
p1ready.SetActive(true);
36+
}
37+
public void p1Ready()
38+
{
39+
p1join.SetActive(false);
40+
p1ready.SetActive(false);
41+
42+
p1confirm.SetActive(true);
43+
}
44+
public void p2JoinedGame()
45+
{
46+
p2Joined = true;
47+
p2waitingText.SetActive(false);
48+
p2pressAnyButton.SetActive(false);
49+
50+
p2join.SetActive(true);
51+
p2ready.SetActive(true);
52+
}
53+
public void p2Ready()
54+
{
55+
p2join.SetActive(false);
56+
p2ready.SetActive(false);
57+
58+
p2confirm.SetActive(true);
59+
}
60+
}

‎Native_Compilation_Project/Assets/PvP/Scripts/PvP_StartManager.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /