Compare commits

...

2 Commits

Author SHA1 Message Date
BOT Alex 801dcd3d66 Merge branch 'main' of https://gitea.deprived.dev/Sveskejuice/fgm24 2024-02-27 20:18:39 +01:00
BOT Alex 9a2538c772 Players now registers themselvs to gamemanager 2024-02-27 20:18:17 +01:00
12 changed files with 4897 additions and 77 deletions

View File

@ -52,6 +52,8 @@ SpriteRenderer:
m_ReflectionProbeUsage: 1 m_ReflectionProbeUsage: 1
m_RayTracingMode: 0 m_RayTracingMode: 0
m_RayTraceProcedural: 0 m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
@ -89,7 +91,7 @@ SpriteRenderer:
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!95 &8069942137008974672 --- !u!95 &8069942137008974672
Animator: Animator:
serializedVersion: 5 serializedVersion: 7
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -103,6 +105,7 @@ Animator:
m_ApplyRootMotion: 0 m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0 m_LinearVelocityBlending: 0
m_StabilizeFeet: 0 m_StabilizeFeet: 0
m_AnimatePhysics: 0
m_WarningMessage: m_WarningMessage:
m_HasTransformHierarchy: 1 m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1 m_AllowConstantClipSamplingOptimization: 1
@ -116,6 +119,7 @@ CircleCollider2D:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1936012740462134995} m_GameObject: {fileID: 1936012740462134995}
m_Enabled: 1 m_Enabled: 1
serializedVersion: 3
m_Density: 1 m_Density: 1
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_IncludeLayers: m_IncludeLayers:
@ -139,9 +143,9 @@ CircleCollider2D:
m_Bits: 4294967295 m_Bits: 4294967295
m_IsTrigger: 0 m_IsTrigger: 0
m_UsedByEffector: 0 m_UsedByEffector: 0
m_UsedByComposite: 0 m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
serializedVersion: 2
m_Radius: 0.5 m_Radius: 0.5
--- !u!114 &5062989152879916107 --- !u!114 &5062989152879916107
MonoBehaviour: MonoBehaviour:
@ -318,6 +322,8 @@ GameObject:
- component: {fileID: 5998872828059799024} - component: {fileID: 5998872828059799024}
- component: {fileID: 8582716114041666362} - component: {fileID: 8582716114041666362}
- component: {fileID: 4721273529951287494} - component: {fileID: 4721273529951287494}
- component: {fileID: 93986863963319370}
- component: {fileID: -5630779774840087441}
m_Layer: 7 m_Layer: 7
m_Name: NetworkedPlayer m_Name: NetworkedPlayer
m_TagString: Player m_TagString: Player
@ -355,7 +361,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3dbdb849a2f5df14d9e109a7776c5ac0, type: 3} m_Script: {fileID: 11500000, guid: 3dbdb849a2f5df14d9e109a7776c5ac0, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
animationHandler: {fileID: 0}
moveSpeed: 70 moveSpeed: 70
whipSmashSpeed: 2 whipSmashSpeed: 2
whipSmashDamageMult: 2 whipSmashDamageMult: 2
@ -468,7 +473,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3} m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
GlobalObjectIdHash: 4009941625 GlobalObjectIdHash: 2899378164
InScenePlacedSourceGlobalObjectIdHash: 0
AlwaysReplicateAsRoot: 0 AlwaysReplicateAsRoot: 0
SynchronizeTransform: 1 SynchronizeTransform: 1
ActiveSceneSynchronization: 0 ActiveSceneSynchronization: 0
@ -527,6 +533,8 @@ TrailRenderer:
m_ReflectionProbeUsage: 0 m_ReflectionProbeUsage: 0
m_RayTracingMode: 0 m_RayTracingMode: 0
m_RayTraceProcedural: 0 m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
@ -631,6 +639,49 @@ TrailRenderer:
m_Autodestruct: 0 m_Autodestruct: 0
m_Emitting: 1 m_Emitting: 1
m_ApplyActiveColorSpace: 1 m_ApplyActiveColorSpace: 1
--- !u!114 &93986863963319370
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3120938410244321186}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1f57343bf29d26c4995925ddca512e41, type: 3}
m_Name:
m_EditorClassIdentifier:
UseUnreliableDeltas: 0
SyncPositionX: 1
SyncPositionY: 1
SyncPositionZ: 0
SyncRotAngleX: 0
SyncRotAngleY: 0
SyncRotAngleZ: 0
SyncScaleX: 0
SyncScaleY: 0
SyncScaleZ: 0
PositionThreshold: 0.001
RotAngleThreshold: 0.01
ScaleThreshold: 0.01
UseQuaternionSynchronization: 0
UseQuaternionCompression: 0
UseHalfFloatPrecision: 0
InLocalSpace: 0
Interpolate: 1
SlerpPosition: 0
--- !u!114 &-5630779774840087441
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3120938410244321186}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b84328426b0c0d34680fca7de411409b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &6225877037457186740 --- !u!1001 &6225877037457186740
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

File diff suppressed because it is too large Load Diff

View File

@ -8,16 +8,9 @@ using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour public class GameManager : MonoBehaviour
{ {
public static GameManager Instance { get; private set; } public static GameManager Instance { get; private set; }
public List<GameObject> Players = new List<GameObject>();
public Action OnPlayerDied; public static Action<GameObject[]> OnPlayersReady;
private string penisSuriveTime = "";
public int Revives { get; private set; }
public GameObject ReviveParticleSystem;
public TMPro.TextMeshProUGUI ReviveText;
void Awake() void Awake()
{ {
@ -27,71 +20,60 @@ public class GameManager : MonoBehaviour
} }
Instance = this; Instance = this;
Revives = 1;
ReviveText.text = Revives + "x";
} }
void Start() void Start()
{ {
StartCoroutine(WaitForPlayers());
} }
public void playerDied(GameObject who) private IEnumerator WaitForPlayers()
{ {
Debug.Log($"{who.name} died"); yield return new WaitUntil(()=>Players.Count == 2);
if (Revives == 0) OnPlayersReady?.Invoke(Players.ToArray());
{
AudioManager.Instance.StopAllAudio();
AudioManager.PlaySound("Game_Over_Jingle", Vector3.zero);
SceneManager.LoadScene(3);
}
else
{
Revives--;
ReviveText.text = Revives + "x";
Collider2D[] d = Physics2D.OverlapCircleAll(who.transform.position, 3f);
Debug.Log(d);
foreach (Collider2D c in d)
{
if (c.gameObject.CompareTag("Enemy"))
{
c.gameObject.GetComponent<HealthComponent>().TakeDamage(69420);
}
} }
var g = who.GetComponent<HealthComponent>(); //public void playerDied(GameObject who)
// heal //{
g.setMaxHealth(g.getMaxHealth(), true); // Debug.Log($"{who.name} died");
g.resetKillFlag(); // if (Revives == 0)
// {
// AudioManager.Instance.StopAllAudio();
// AudioManager.PlaySound("Game_Over_Jingle", Vector3.zero);
// SceneManager.LoadScene(3);
// }
// else
// {
// Revives--;
// ReviveText.text = Revives + "x";
// Collider2D[] d = Physics2D.OverlapCircleAll(who.transform.position, 3f);
// REVIVE SOUND HERE // Debug.Log(d);
AudioManager.PlaySound("Revive_SFX", who.transform.position);
RumbleManager.StartRumble(0, 0.3f, 0.1f, 3f);
RumbleManager.StartRumble(1, 0.3f, 0.1f, 3f);
GameObject go = Instantiate(ReviveParticleSystem, who.transform.position, Quaternion.identity); // foreach (Collider2D c in d)
ParticleSystem ps = go.GetComponent<ParticleSystem>(); // {
ps.Play(); // if (c.gameObject.CompareTag("Enemy"))
// {
// c.gameObject.GetComponent<HealthComponent>().TakeDamage(69420);
// }
// }
go.AddComponent<DestroyAfter>().Init(5f); // var g = who.GetComponent<HealthComponent>();
} // // heal
} // g.setMaxHealth(g.getMaxHealth(), true);
// g.resetKillFlag();
public void AddRevive() // // REVIVE SOUND HERE
{ // AudioManager.PlaySound("Revive_SFX", who.transform.position);
Revives++; // RumbleManager.StartRumble(0, 0.3f, 0.1f, 3f);
ReviveText.text = Revives + "x"; // RumbleManager.StartRumble(1, 0.3f, 0.1f, 3f);
}
public void setTime(string t) // GameObject go = Instantiate(ReviveParticleSystem, who.transform.position, Quaternion.identity);
{ // ParticleSystem ps = go.GetComponent<ParticleSystem>();
penisSuriveTime = t; // ps.Play();
}
// Update is called once per frame // go.AddComponent<DestroyAfter>().Init(5f);
void Update() // }
{ //}
}
} }

View File

@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using Unity.Netcode.Components;
using UnityEngine;
/// <summary>
/// Used for syncing a transform with client side changes. This includes host. Pure server as owner isn't supported by this. Please use NetworkTransform
/// for transforms that'll always be owned by the server.
/// </summary>
[DisallowMultipleComponent]
public class ClientNetworkTransform : NetworkTransform
{
/// <summary>
/// Used to determine who can write to this transform. Owner client only.
/// This imposes state to the server. This is putting trust on your clients. Make sure no security-sensitive features use this transform.
/// </summary>
protected override bool OnIsServerAuthoritative()
{
return false;
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1f57343bf29d26c4995925ddca512e41

View File

@ -35,12 +35,13 @@ public class NetworkedGameSetup : NetworkBehaviour
bool isServer = SteamManager.IsServer || LocalManager.IsServer; bool isServer = SteamManager.IsServer || LocalManager.IsServer;
GameObject[] players; GameObject[] players;
if (isServer)
players = SpawnPlayers(playerIds); players = SpawnPlayers(playerIds);
else //if (isServer)
players = GetPlayers(playerIds); // players = SpawnPlayers(playerIds);
//else
// players = GetPlayers(playerIds);
StartCoroutine(LateSetupProcedue(players)); //StartCoroutine(LateSetupProcedue(players));
} }
private IEnumerator LateSetupProcedue(GameObject[] players) private IEnumerator LateSetupProcedue(GameObject[] players)

View File

@ -0,0 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using Unity.Netcode;
using UnityEngine;
public class NetworkedPlayerRegister : NetworkBehaviour
{
public override void OnNetworkSpawn()
{
GameManager.Instance.Players.Add(this.gameObject);
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b84328426b0c0d34680fca7de411409b

View File

@ -12,7 +12,8 @@
"GUID:42d1898a72cfe6848ae89835fb20acd2", "GUID:42d1898a72cfe6848ae89835fb20acd2",
"GUID:ff1c299121c93f34ca827a253fc30a61", "GUID:ff1c299121c93f34ca827a253fc30a61",
"GUID:1eb4e3e6c04cdc848bab71651b1e2ecd", "GUID:1eb4e3e6c04cdc848bab71651b1e2ecd",
"GUID:62165c64e8180c441b8cfaa6b82208af" "GUID:62165c64e8180c441b8cfaa6b82208af",
"GUID:c0e1b40f519e6e84b8f4af9930403ecb"
], ],
"includePlatforms": [], "includePlatforms": [],
"excludePlatforms": [], "excludePlatforms": [],

View File

@ -22,6 +22,5 @@ public class SurvivalTimer : MonoBehaviour
int minutes = Mathf.FloorToInt(elapsedTime / 60); int minutes = Mathf.FloorToInt(elapsedTime / 60);
int seconds = Mathf.FloorToInt(elapsedTime % 60); int seconds = Mathf.FloorToInt(elapsedTime % 60);
timerText.text = string.Format("{00:00}:{01:00}", minutes, seconds); timerText.text = string.Format("{00:00}:{01:00}", minutes, seconds);
GameManager.Instance.setTime(timerText.text);
} }
} }

View File

@ -360,7 +360,6 @@ public class Upgrader : MonoBehaviour
public void ReviveUpgrade() public void ReviveUpgrade()
{ {
description.text = upgrades.reviveUpgrade.name; description.text = upgrades.reviveUpgrade.name;
GameManager.Instance.AddRevive();
} }
IEnumerator updateBloodMeter() IEnumerator updateBloodMeter()

View File

@ -19,3 +19,4 @@ EditorBuildSettings:
guid: 485a4a01988ea88d08f76e749dcbd6c0 guid: 485a4a01988ea88d08f76e749dcbd6c0
m_configObjects: m_configObjects:
com.unity.input.settings: {fileID: 11400000, guid: de04e34f85a966e4da851d9b3d804fa1, type: 2} com.unity.input.settings: {fileID: 11400000, guid: de04e34f85a966e4da851d9b3d804fa1, type: 2}
m_UseUCBPForAssetBundles: 0