Skip to content

Commit

Permalink
Merge pull request #65 from siwei-yuan/main
Browse files Browse the repository at this point in the history
bug fix
  • Loading branch information
siwei-yuan authored Jun 7, 2023
2 parents 177fa31 + ea7e0e2 commit 06a2771
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 21 deletions.
52 changes: 34 additions & 18 deletions Assets/Scripts/SkillSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public class SkillSystem : NetworkBehaviour
public Texture2D SlowDownTex = null;
public Texture2D InverseControlTex = null;

private int SelfPlayerID = -1;
private int OppoPlayerID = -1;
public int SelfPlayerID = -1;
public int OppoPlayerID = -1;

private float SpeedUpTimeLeft = 0;

Expand All @@ -40,24 +40,28 @@ public class SkillSystem : NetworkBehaviour
//}


private void Start()
{
SelfPlayerID = gameObject.GetComponent<NetworkInfo>().PlayerID;
if (SelfPlayerID == 1 )
{
OppoPlayerID = 2;
}
else
{
OppoPlayerID = 1;
}
}
//private void Start()
//{
// if (isLocalPlayer)
// {
// SelfPlayerID = gameObject.GetComponent<NetworkInfo>().PlayerID;
// if (SelfPlayerID == 1)
// {
// OppoPlayerID = 2;
// }
// else
// {
// OppoPlayerID = 1;
// }
// }
//}


void UpdateSkillUI()
{
if (isLocalPlayer)
{

for (int i=0; i<3; i++) {
if (MySkills[i] != null)
{
Expand Down Expand Up @@ -92,7 +96,20 @@ void Update()
// THIS SECTION WILL BE DEPRECATED AFTER MQTT INTEGRATION
if (isLocalPlayer)
{


if (SelfPlayerID == -1 || OppoPlayerID == -1)
{
SelfPlayerID = GetComponent<NetworkInfo>().PlayerID;
if (SelfPlayerID == 1)
{
OppoPlayerID = 2;
}
else
{
OppoPlayerID = 1;
}
}

string playerMode = GetComponent<SwitchMode>().mode;

if (Input.GetKeyDown(KeyCode.Alpha1) && MySkills[0] != null && playerMode == "Attack Mode")
Expand Down Expand Up @@ -133,16 +150,14 @@ void Update()
GetComponent<PrometeoCarController>().accelerationMultiplier = 10;
SpeedUpTimeLeft -= Time.deltaTime;
UpdatePlayerStatus(SelfPlayerID, 0, true);
}
}
else if ((SelfPlayerID == 1 && !statusTracker.player1_slowdown) || (SelfPlayerID == 2 && !statusTracker.player2_slowdown))
{
GetComponent<PrometeoCarController>().maxSpeed = GetComponent<PrometeoCarController>().OriginalMaxSpeed;
GetComponent<PrometeoCarController>().accelerationMultiplier = GetComponent<PrometeoCarController>().OriginalAccelerationMultiplier;
UpdatePlayerStatus(SelfPlayerID, 0, false);
SpeedUpTimeLeft = 0;
}


}
}

Expand Down Expand Up @@ -223,6 +238,7 @@ private void ReleaseSkill(string skill)
[Command(requiresAuthority = false)]
private void UpdatePlayerStatus(int playerID, int type, bool setTo)
{
Debug.Log($"PlayerStatus: {playerID}");

StatusTracker statusTracker = GameObject.FindGameObjectWithTag("StatusTracker").GetComponent<StatusTracker>();

Expand Down
6 changes: 3 additions & 3 deletions ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--- !u!129 &1
PlayerSettings:
m_ObjectHideFlags: 0
serializedVersion: 23
serializedVersion: 24
productGUID: cf115d1544fc7774487863e774a7d67c
AndroidProfiler: 0
AndroidFilterTouchesWhenObscured: 0
Expand Down Expand Up @@ -99,7 +99,7 @@ PlayerSettings:
xboxEnableFitness: 0
visibleInBackground: 1
allowFullscreenSwitch: 1
fullscreenMode: 1
fullscreenMode: 3
xboxSpeechDB: 0
xboxEnableHeadOrientation: 0
xboxEnableGuest: 0
Expand Down Expand Up @@ -460,7 +460,6 @@ PlayerSettings:
switchReleaseVersion: 0
switchDisplayVersion: 1.0.0
switchStartupUserAccount: 0
switchTouchScreenUsage: 0
switchSupportedLanguagesMask: 0
switchLogoType: 0
switchApplicationErrorCodeCategory:
Expand Down Expand Up @@ -502,6 +501,7 @@ PlayerSettings:
switchNativeFsCacheSize: 32
switchIsHoldTypeHorizontal: 0
switchSupportedNpadCount: 8
switchEnableTouchScreen: 1
switchSocketConfigEnabled: 0
switchTcpInitialSendBufferSize: 32
switchTcpInitialReceiveBufferSize: 64
Expand Down

0 comments on commit 06a2771

Please sign in to comment.