Skip to content

Commit

Permalink
Game Prototype V0.22.10 Multiplayer Online System
Browse files Browse the repository at this point in the history
- Fix Bug Enemy Stuck Fence
- Fix Player Not Shoot Bullet Sometime
- Fix Find Room Not Show Room Name
- Fix Bug Other Client Can Kick Other Player
  • Loading branch information
Kong-TH committed Feb 25, 2024
1 parent 0ecf08e commit 1482a37
Show file tree
Hide file tree
Showing 27 changed files with 88 additions and 71 deletions.
2 changes: 1 addition & 1 deletion Assets/Prefabs/UI/Character/CharacterStatus.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_textHP: {fileID: 5825938031353813385}
m_HPProgress: {fileID: 7236731501791783930}
m_ShieldProgress: {fileID: 0}
m_ShieldProgress: {fileID: 102397271222286733}
m_textEXPLevel: {fileID: 5825938032015083461}
m_EXPProgress: {fileID: 859298254391012612}
--- !u!114 &8910124535595774818
Expand Down
6 changes: 3 additions & 3 deletions Assets/Prefabs/UI/LogIn_Out/Login_OutUI.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -3958,7 +3958,7 @@ RectTransform:
m_Children:
- {fileID: 5458690533434192181}
m_Father: {fileID: 5458690533762692272}
m_RootOrder: 5
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
Expand Down Expand Up @@ -8175,8 +8175,8 @@ RectTransform:
- {fileID: 5458690533416711516}
- {fileID: 5458690532552941514}
- {fileID: 5458690532786251077}
- {fileID: 4341482775204819560}
- {fileID: 5458690532671214701}
- {fileID: 4341482775204819560}
- {fileID: 3648141378702325247}
- {fileID: 5458690532202910504}
m_Father: {fileID: 5458690531767175880}
Expand Down Expand Up @@ -8829,7 +8829,7 @@ RectTransform:
m_Children:
- {fileID: 5024230603345012596}
m_Father: {fileID: 5458690533762692272}
m_RootOrder: 4
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Resources/CheesePlayerMulti.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -2340,7 +2340,7 @@ MonoBehaviour:
type: 3}
_readyCheck: {fileID: 6816264394569927125}
m_delay_attack: 0.25
vision: {x: 10, y: 10}
vision: {x: 20, y: 20}
isLobbyMode: 0
--- !u!114 &7120464432609602796
MonoBehaviour:
Expand Down
12 changes: 10 additions & 2 deletions Assets/Resources/PlayerArmature_MultiTest.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,7 @@ MonoBehaviour:
CameraRoot: {fileID: 5509665787452780490}
m_statusUI: {fileID: 5825938031019873916, guid: a814269ff4c6fc442a255976deb331c6,
type: 3}
m_bodySkin: {fileID: 0}
--- !u!114 &3687693191306519284
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -945,14 +946,14 @@ MonoBehaviour:
m_EditorClassIdentifier:
cellPos: {x: 0, y: 0}
m_hp_text: {fileID: 475180726385747780}
m_namePlayerText: {fileID: 0}
m_hp_bar: {fileID: 2335550544014905371}
m_shield_bar: {fileID: 3502949648701098777}
m_hp: 100
m_max_HP: 100
m_shield: 100
_maxEXP: 100
m_levelUp: 1.1
_reviveTime: 2
m_animator: {fileID: 0}
m_deadAnimatorState: isDead
m_reviveAnimatorState: isRevive
Expand All @@ -962,13 +963,15 @@ MonoBehaviour:
m_OnRevive:
m_PersistentCalls:
m_Calls: []
_reviveTime: 2
m_ReviveUI: {fileID: 0}
m_skillRandomUI: {fileID: 2005608045575106628, guid: dd27f74880ca05948922fe56b975edce,
type: 3}
m_randomSpinWheel: {fileID: 7748829778939500841, guid: 5b551d98d27fd9949abd1c7c6f72bfff,
type: 3}
_readyCheck: {fileID: 291524276705014652}
m_delay_attack: 0.25
vision: {x: 10, y: 10}
vision: {x: 20, y: 20}
isLobbyMode: 0
--- !u!4 &705807638788262956 stripped
Transform:
Expand All @@ -995,6 +998,11 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 705807638788262956}
m_Modifications:
- target: {fileID: 2440012129404535158, guid: f21ab0b33c35fa643b20be7913d6980a,
type: 3}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 2622021137496978663, guid: f21ab0b33c35fa643b20be7913d6980a,
type: 3}
propertyPath: m_AnchorMax.x
Expand Down
16 changes: 2 additions & 14 deletions Assets/Resources/TriGrenadeKeepLaunching_AI_Monster.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ PrefabInstance:
- target: {fileID: 549421543, guid: 262e3c1c20ec64b4ab5beb8d78568e61, type: 3}
propertyPath: m_OnDead.m_PersistentCalls.m_Calls.Array.data[3].m_Target
value:
objectReference: {fileID: 7434617591950528823}
objectReference: {fileID: 0}
- target: {fileID: 549421543, guid: 262e3c1c20ec64b4ab5beb8d78568e61, type: 3}
propertyPath: m_OnDead.m_PersistentCalls.m_Calls.Array.data[3].m_MethodName
value: set_enabled
Expand Down Expand Up @@ -321,10 +321,10 @@ PrefabInstance:
- {fileID: 1804085855532818162, guid: 262e3c1c20ec64b4ab5beb8d78568e61, type: 3}
- {fileID: 3527415465607005499, guid: 262e3c1c20ec64b4ab5beb8d78568e61, type: 3}
- {fileID: 549421540, guid: 262e3c1c20ec64b4ab5beb8d78568e61, type: 3}
- {fileID: 8856079723556138974, guid: 262e3c1c20ec64b4ab5beb8d78568e61, type: 3}
- {fileID: 2022173739784471013, guid: 262e3c1c20ec64b4ab5beb8d78568e61, type: 3}
- {fileID: 1286383971283845097, guid: 262e3c1c20ec64b4ab5beb8d78568e61, type: 3}
- {fileID: 1194258277064258382, guid: 262e3c1c20ec64b4ab5beb8d78568e61, type: 3}
- {fileID: 76614021475303580, guid: 262e3c1c20ec64b4ab5beb8d78568e61, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: 262e3c1c20ec64b4ab5beb8d78568e61, type: 3}
--- !u!1 &628791750963113795 stripped
GameObject:
Expand Down Expand Up @@ -499,15 +499,3 @@ NavMeshAgent:
type: 3}
m_PrefabInstance: {fileID: 7367081144338960811}
m_PrefabAsset: {fileID: 0}
--- !u!114 &7434617591950528823 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 76614021475303580, guid: 262e3c1c20ec64b4ab5beb8d78568e61,
type: 3}
m_PrefabInstance: {fileID: 7367081144338960811}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 628791750963113795}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c0f9edcadbf7431ebe984ef44ff7d220, type: 3}
m_Name:
m_EditorClassIdentifier:
2 changes: 1 addition & 1 deletion Assets/Scenes/GameScene/LoginScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_IndirectSpecularColor: {r: 262.11768, g: 324.74365, b: 429.81006, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scenes/TemplateLevel/CH1/Level 1.unity
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ NavMeshSettings:
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.3
agentRadius: 0.5
agentHeight: 1.5
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.1
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
Expand Down
Binary file modified Assets/Scenes/TemplateLevel/CH1/Level 1/NavMesh.asset
Binary file not shown.
2 changes: 1 addition & 1 deletion Assets/Scenes/TemplateLevel/CH1/Level 2.unity
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 262.11768, g: 324.74365, b: 429.81006, a: 1}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down
Binary file modified Assets/Scenes/TemplateLevel/CH1/Level 2/NavMesh.asset
Binary file not shown.
4 changes: 2 additions & 2 deletions Assets/Scenes/TemplateLevel/CH1/Level 3.unity
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ NavMeshSettings:
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.3
agentRadius: 0.5
agentHeight: 1.5
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.1
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
Expand Down
Binary file modified Assets/Scenes/TemplateLevel/CH1/Level 3/NavMesh.asset
Binary file not shown.
4 changes: 2 additions & 2 deletions Assets/Scenes/TemplateLevel/CH1/Level 4.unity
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ NavMeshSettings:
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.3
agentRadius: 0.5
agentHeight: 1.5
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.1
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
Expand Down
Binary file modified Assets/Scenes/TemplateLevel/CH1/Level 4/NavMesh.asset
Binary file not shown.
4 changes: 2 additions & 2 deletions Assets/Scenes/TemplateLevel/CH1/Level 5.unity
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ NavMeshSettings:
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.3
agentRadius: 0.5
agentHeight: 1.5
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.1
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
Expand Down
Binary file modified Assets/Scenes/TemplateLevel/CH1/Level 5/NavMesh.asset
Binary file not shown.
4 changes: 2 additions & 2 deletions Assets/Scripts/Systems/Bullet/BulletIgnition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,7 @@ private void CreateProjectileReflectionBullet(ObjectPoolBuilder builder, Transfo
bullets.Add(bullet);
}

public void OnProjectileLaunch(ObjectPoolBuilder builder, Transform spawnPoint, int shot, float damage,
int[] posIndex = default)
public void OnProjectileLaunch(ObjectPoolBuilder builder, Transform spawnPoint, int shot, float damage, int[] posIndex = default)
{
EnemySystem _enemySystem = builder.GetComponent<EnemySystem>();

Expand Down Expand Up @@ -322,6 +321,7 @@ public void OnProjectileLaunch(ObjectPoolBuilder builder, Transform spawnPoint,
else
posToTarget = PtvTarget.transform.position;
}

if (i > 0)
{
if (GM.playMode == PlayMode.Singleplayer)
Expand Down
17 changes: 15 additions & 2 deletions Assets/Scripts/Systems/Character/Enemies/EnemySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,22 @@ protected void RandomWayPointPosition()
Vector3 randomDirection = Random.insideUnitSphere * (GM.mapWidth / 2);
randomDirection += new Vector3(GM.mapWidth / 2, transform.position.y, GM.mapWidth / 2);
NavMeshHit _hit;
NavMesh.SamplePosition(randomDirection, out _hit, (GM.mapWidth / 2), 1);
NavMeshHit _hitOverMap;

bool isOverMap = NavMesh.SamplePosition(randomDirection, out _hit, (GM.mapWidth / 2), 1);

_waypoint.transform.position = _hit.position;
if (isOverMap)
{
print($"Over Map {_hit.position}");
NavMesh.SamplePosition(randomDirection * Random.Range(0.5f, 0.85f), out _hitOverMap, (GM.mapWidth / 2), 1);
_waypoint.transform.position = _hitOverMap.position;
print($"New Pos {_hitOverMap.position}");
}
else
{
print("Not Over Map");
_waypoint.transform.position = _hit.position;
}
}

private void UpdateEnemyMove()
Expand Down
6 changes: 3 additions & 3 deletions Assets/Scripts/Systems/Manager/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ void Start()
{
readyTimer = new AwaitTimer(5.0f, () =>
{
print("Update SaveGame To Server");
//print("Update SaveGame To Server");
HideWarningUI();
//Update Save
DBC.OnUpdateSucceed += UpdateSaveGameServer;
DBC.OnUpdate(playerInfo, gameInstance);
}, time =>
{
openSceneTime = time;
print($"Time : {time}");
//print($"Time : {time}");
});
}

Expand Down Expand Up @@ -208,7 +208,7 @@ public void OnReady(bool isLobby = false)

if (readyPlayer && (enemies.Count <= 0 || isLobby))
{
print("Ready Check !!!");
//print("Ready Check !!!");
readyTimer.Start();
Canvas_Element_List canvasElementList = CreateWarningUI();
canvasElementList.texts[1].text = $"Entering to {PunLevelManager.Instance.openLevel}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class PunLevelManager : CanDestroy_Sinagleton<PunLevelManager>
[SerializeField] private CinemachineVirtualCamera _vCam;
[SerializeField] private bool _isReJoinLobbyOrRoom = true;
private GameManager GM;
private UnityAction _sceneLoaded;
private UnityAction<bool> _sceneLoaded;

public List<Transform> playerSpawnPoint
{
Expand Down Expand Up @@ -63,7 +63,7 @@ public CinemachineVirtualCamera vCam
get => _vCam;
}

public UnityAction sceneLoaded
public UnityAction<bool> sceneLoaded
{
get => _sceneLoaded;
set => _sceneLoaded = value;
Expand All @@ -85,8 +85,7 @@ void OnSceneLoaded(Scene scene, LoadSceneMode mode)
GM.player_layer = m_playerLevel;
GM.enemy_layer = m_enemyLevel;

if(_isReJoinLobbyOrRoom)
_sceneLoaded?.Invoke();
_sceneLoaded?.Invoke(isReJoinLobbyOrRoom);

if(PhotonNetwork.IsMasterClient)
PunNetworkManager.Instance.currentGameState = PunGameState.GamePlay;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,6 @@ public override void OnConnectedToMaster()
_onJoinConnectToMasterAction?.Invoke();
print("OnConnectedToMaster !!!!!!!!!");

if(!PLM.isReJoinLobbyOrRoom)
return;

OnLeftLevel?.Invoke();
OnJoinLevel = () =>
{
Expand Down Expand Up @@ -392,18 +389,20 @@ private void OnCreateCharacterUI()
private void OnLevelLoad(Scene scene, LoadSceneMode loadSceneMode)
{
PLM = PunLevelManager.Instance;
if(!PLM.isReJoinLobbyOrRoom)
return;

PLM.sceneLoaded = () =>
PLM.sceneLoaded = isLobby =>
{
if(_characterStatusUI == null)
if(_characterStatusUI == null && isLobby)
OnCreateCharacterUI();

if (PhotonNetwork.InRoom)
{
GameManager.Instance.players = new SerializedDictionary<PlayerSystem, bool>();
_currentGameState = PunGameState.GameOver;
if (isLobby)
{
GameManager.Instance.players = new SerializedDictionary<PlayerSystem, bool>();
_currentGameState = PunGameState.GameOver;
}

PunNetworkManager.Instance.SpawnPlayer();
}

Expand Down Expand Up @@ -448,7 +447,7 @@ public void gameStateUpdate(Hashtable propertiesThatChanged) {
object gameStateFromProps;

if (propertiesThatChanged.TryGetValue(PunGameSetting.GAMESTATE, out gameStateFromProps)) {
Debug.Log("GetStartTime Prop is : " + (PunGameState)gameStateFromProps);
//Debug.Log("GetStartTime Prop is : " + (PunGameState)gameStateFromProps);
_currentGameState = (PunGameState)gameStateFromProps;
}

Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Systems/Scene/LoadingSceneSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ IEnumerator LoadSceneAsync(string SceneName)
progressValue = Mathf.Clamp01(operation.progress / 0.9f);

LoadingBarfill.GetComponent<Image>().fillAmount = progressValue;
print("Loading : " + operation.progress + " ----------------------------------------------");
//print("Loading : " + operation.progress + " ----------------------------------------------");
yield return null;
if((operation.progress / 0.9f) >= 1)
OpenScene();
Expand Down
Loading

0 comments on commit 1482a37

Please sign in to comment.