Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
animalHunters
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abdulrahman Mohammed
animalHunters
Commits
c831d64b
Commit
c831d64b
authored
Feb 01, 2026
by
Abdulrahman Mohammed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sync player data in lobby and add approvr connection
parent
30704ce9
Changes
32
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
1590 additions
and
455 deletions
+1590
-455
GameSetting.asset
Assets/_project/GameSetting.asset
+1
-2
Crocodile.prefab
Assets/_project/Prefabs/Animals/Crocodile.prefab
+30
-27
1_Ostrich.prefab
.../_project/Prefabs/Animals/Desert Animals/1_Ostrich.prefab
+30
-27
2_Lion.prefab
Assets/_project/Prefabs/Animals/Desert Animals/2_Lion.prefab
+30
-27
3_Snake.prefab
...ts/_project/Prefabs/Animals/Desert Animals/3_Snake.prefab
+30
-27
1_Bear.prefab
Assets/_project/Prefabs/Animals/Forest Animals/1_Bear.prefab
+30
-27
2_Monkey.prefab
...s/_project/Prefabs/Animals/Forest Animals/2_Monkey.prefab
+30
-27
1_Penguin.prefab
Assets/_project/Prefabs/Animals/Ice Animals/1_Penguin.prefab
+30
-27
1_PolarBear.prefab
...s/_project/Prefabs/Animals/Ice Animals/1_PolarBear.prefab
+30
-27
Player.prefab
Assets/_project/Prefabs/Players/Player.prefab
+188
-12
Game.unity
Assets/_project/Scenes/Game.unity
+649
-109
LobbyScene.unity
Assets/_project/Scenes/LobbyScene.unity
+154
-1
AnimalsQuestionGenerator.cs
Assets/_project/Scripts/Core/AnimalsQuestionGenerator.cs
+1
-1
AnimalsSpawner.cs
Assets/_project/Scripts/Core/Manager/AnimalsSpawner.cs
+1
-1
HandlePlayersConnection.cs
...ect/Scripts/Network/Connection/HandlePlayersConnection.cs
+18
-11
ApprovRequest.cs
Assets/_project/Scripts/Network/Data/ApprovRequest.cs
+40
-0
ApprovRequest.cs.meta
Assets/_project/Scripts/Network/Data/ApprovRequest.cs.meta
+2
-0
PlayerData.cs
Assets/_project/Scripts/Network/Data/PlayerData.cs
+7
-12
CreateLobby.cs
Assets/_project/Scripts/Network/Lobby/CreateLobby.cs
+4
-0
LobbyRoom.cs
Assets/_project/Scripts/Network/Lobby/LobbyRoom.cs
+100
-34
GameHUD.cs
Assets/_project/Scripts/Network/Ui/GameHUD.cs
+4
-3
PlayersInLobbyRoom.cs
Assets/_project/Scripts/Network/Ui/PlayersInLobbyRoom.cs
+1
-1
AllocationRequest.cs
...Scripts/Network/_Requests/Allocation/AllocationRequest.cs
+1
-1
AnimalAi.cs
Assets/_project/Scripts/Systems/Animal/AnimalAi.cs
+65
-6
AnimalDetails.cs
Assets/_project/Scripts/Systems/Animal/AnimalDetails.cs
+3
-3
BodyPart.cs
Assets/_project/Scripts/Systems/Health/BodyPart.cs
+1
-1
Health.cs
Assets/_project/Scripts/Systems/Health/Health.cs
+61
-17
PlayerDetails.cs
Assets/_project/Scripts/Systems/Player/PlayerDetails.cs
+15
-8
HumanHealth.cs
Assets/_project/Scripts/Systems/Shared/HumanHealth.cs
+15
-5
Score.cs
Assets/_project/Scripts/Systems/Shared/Score.cs
+16
-9
RaycastWeapon.cs
Assets/_project/Scripts/Systems/Weapon/RaycastWeapon.cs
+2
-1
EditorSettings.asset
ProjectSettings/EditorSettings.asset
+1
-1
No files found.
Assets/_project/GameSetting.asset
View file @
c831d64b
...
...
@@ -12,7 +12,6 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
95cd0eaad76fefd4cb783db82775f08d
,
type
:
3
}
m_Name
:
GameSetting
m_EditorClassIdentifier
:
Assembly-CSharp::GameSetting
<MaxPlayersInGame>k__BackingField
:
4
<MaxAnimalsInRound>k__BackingField
:
16
<MaxAnimalsInRound>k__BackingField
:
20
<TimeOfRound>k__BackingField
:
60
<NumberOfRounds>k__BackingField
:
5
Assets/_project/Prefabs/Animals/Crocodile.prefab
View file @
c831d64b
...
...
@@ -4084,10 +4084,10 @@ GameObject:
-
component
:
{
fileID
:
1551918764560250124
}
-
component
:
{
fileID
:
7285165323552836935
}
-
component
:
{
fileID
:
3540747456963741744
}
-
component
:
{
fileID
:
4571425764186860664
}
-
component
:
{
fileID
:
6792771870626713340
}
-
component
:
{
fileID
:
9180733274907734800
}
-
component
:
{
fileID
:
7239363159011139443
}
-
component
:
{
fileID
:
4571425764186860664
}
-
component
:
{
fileID
:
750448506894433358
}
-
component
:
{
fileID
:
7059936128646914008
}
m_Layer
:
3
...
...
@@ -4182,6 +4182,31 @@ BoxCollider:
serializedVersion
:
3
m_Size
:
{
x
:
0.89796656
,
y
:
1.0282495
,
z
:
2.4177198
}
m_Center
:
{
x
:
9.707167e-17
,
y
:
0.4289297
,
z
:
0.5068307
}
---
!u!114
&4571425764186860664
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
8074876253474731934
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
d5a57f767e5e46a458fc5d3c628d0cbb
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Unity.Netcode.Runtime::Unity.Netcode.NetworkObject
GlobalObjectIdHash
:
3563094922
InScenePlacedSourceGlobalObjectIdHash
:
0
DeferredDespawnTick
:
0
Ownership
:
1
AlwaysReplicateAsRoot
:
0
SynchronizeTransform
:
1
ActiveSceneSynchronization
:
0
SceneMigrationSynchronization
:
1
SpawnWithObservers
:
1
DontDestroyWithOwner
:
0
AutoObjectParentSync
:
1
SyncOwnerTransformWhenParented
:
1
AllowOwnerToParent
:
0
---
!u!114
&6792771870626713340
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -4194,6 +4219,7 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
c116b055ac29f0f4b8d54ba158c620e0
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Assembly-CSharp::AnimalAi
ShowTopMostFoldoutHeaderGroup
:
1
currentState
:
0
debugMode
:
0
---
!u!114
&9180733274907734800
...
...
@@ -4227,31 +4253,8 @@ MonoBehaviour:
healthColor
:
{
r
:
0
,
g
:
0.8039216
,
b
:
0.043137256
,
a
:
1
}
healthBackgroundColor
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
dieParticleSystem
:
{
fileID
:
646967056338719950
}
---
!u!114
&4571425764186860664
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
8074876253474731934
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
d5a57f767e5e46a458fc5d3c628d0cbb
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Unity.Netcode.Runtime::Unity.Netcode.NetworkObject
GlobalObjectIdHash
:
0
InScenePlacedSourceGlobalObjectIdHash
:
0
DeferredDespawnTick
:
0
Ownership
:
1
AlwaysReplicateAsRoot
:
0
SynchronizeTransform
:
1
ActiveSceneSynchronization
:
0
SceneMigrationSynchronization
:
1
SpawnWithObservers
:
1
DontDestroyWithOwner
:
0
AutoObjectParentSync
:
1
SyncOwnerTransformWhenParented
:
1
AllowOwnerToParent
:
0
_healthCounts
:
m_InternalValue
:
0
---
!u!114
&750448506894433358
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -4280,7 +4283,7 @@ MonoBehaviour:
TickSyncChildren
:
0
UseUnreliableDeltas
:
0
SyncPositionX
:
1
SyncPositionY
:
1
SyncPositionY
:
0
SyncPositionZ
:
1
SyncRotAngleX
:
1
SyncRotAngleY
:
1
...
...
Assets/_project/Prefabs/Animals/Desert Animals/1_Ostrich.prefab
View file @
c831d64b
...
...
@@ -598,10 +598,10 @@ GameObject:
-
component
:
{
fileID
:
6851323559094377791
}
-
component
:
{
fileID
:
6067137972868195470
}
-
component
:
{
fileID
:
2713966796924141507
}
-
component
:
{
fileID
:
291547076294712862
}
-
component
:
{
fileID
:
7800256244418275688
}
-
component
:
{
fileID
:
7440580058684414760
}
-
component
:
{
fileID
:
6092317265662781462
}
-
component
:
{
fileID
:
291547076294712862
}
-
component
:
{
fileID
:
1203584073287534396
}
-
component
:
{
fileID
:
4216863301324652201
}
m_Layer
:
3
...
...
@@ -695,6 +695,31 @@ BoxCollider:
serializedVersion
:
3
m_Size
:
{
x
:
1.1762159
,
y
:
1.8948627
,
z
:
1.5460478
}
m_Center
:
{
x
:
-1.1483268e-16
,
y
:
0.86223626
,
z
:
-0.25808057
}
---
!u!114
&291547076294712862
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1698350363645929408
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
d5a57f767e5e46a458fc5d3c628d0cbb
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Unity.Netcode.Runtime::Unity.Netcode.NetworkObject
GlobalObjectIdHash
:
952050147
InScenePlacedSourceGlobalObjectIdHash
:
0
DeferredDespawnTick
:
0
Ownership
:
1
AlwaysReplicateAsRoot
:
0
SynchronizeTransform
:
1
ActiveSceneSynchronization
:
0
SceneMigrationSynchronization
:
1
SpawnWithObservers
:
1
DontDestroyWithOwner
:
0
AutoObjectParentSync
:
1
SyncOwnerTransformWhenParented
:
1
AllowOwnerToParent
:
0
---
!u!114
&7800256244418275688
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -707,6 +732,7 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
c116b055ac29f0f4b8d54ba158c620e0
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Assembly-CSharp::AnimalAi
ShowTopMostFoldoutHeaderGroup
:
1
currentState
:
0
debugMode
:
0
---
!u!114
&7440580058684414760
...
...
@@ -740,31 +766,8 @@ MonoBehaviour:
healthColor
:
{
r
:
0
,
g
:
0.8039216
,
b
:
0.043137256
,
a
:
1
}
healthBackgroundColor
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
dieParticleSystem
:
{
fileID
:
3369560982145558529
}
---
!u!114
&291547076294712862
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1698350363645929408
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
d5a57f767e5e46a458fc5d3c628d0cbb
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Unity.Netcode.Runtime::Unity.Netcode.NetworkObject
GlobalObjectIdHash
:
0
InScenePlacedSourceGlobalObjectIdHash
:
0
DeferredDespawnTick
:
0
Ownership
:
1
AlwaysReplicateAsRoot
:
0
SynchronizeTransform
:
1
ActiveSceneSynchronization
:
0
SceneMigrationSynchronization
:
1
SpawnWithObservers
:
1
DontDestroyWithOwner
:
0
AutoObjectParentSync
:
1
SyncOwnerTransformWhenParented
:
1
AllowOwnerToParent
:
0
_healthCounts
:
m_InternalValue
:
0
---
!u!114
&1203584073287534396
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -793,7 +796,7 @@ MonoBehaviour:
TickSyncChildren
:
0
UseUnreliableDeltas
:
0
SyncPositionX
:
1
SyncPositionY
:
1
SyncPositionY
:
0
SyncPositionZ
:
1
SyncRotAngleX
:
1
SyncRotAngleY
:
1
...
...
Assets/_project/Prefabs/Animals/Desert Animals/2_Lion.prefab
View file @
c831d64b
...
...
@@ -428,10 +428,10 @@ GameObject:
-
component
:
{
fileID
:
6459466032477248462
}
-
component
:
{
fileID
:
447849839389488228
}
-
component
:
{
fileID
:
2436368528606206936
}
-
component
:
{
fileID
:
5598616148842523305
}
-
component
:
{
fileID
:
1126594263064233863
}
-
component
:
{
fileID
:
4268953564234010434
}
-
component
:
{
fileID
:
778063317746192726
}
-
component
:
{
fileID
:
5598616148842523305
}
-
component
:
{
fileID
:
8602419029893464424
}
-
component
:
{
fileID
:
2551338929655459012
}
m_Layer
:
3
...
...
@@ -525,6 +525,31 @@ BoxCollider:
serializedVersion
:
3
m_Size
:
{
x
:
0.89796656
,
y
:
1.6415781
,
z
:
1.6153623
}
m_Center
:
{
x
:
6.0341865e-16
,
y
:
0.735594
,
z
:
0.16746178
}
---
!u!114
&5598616148842523305
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1677546864663295365
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
d5a57f767e5e46a458fc5d3c628d0cbb
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Unity.Netcode.Runtime::Unity.Netcode.NetworkObject
GlobalObjectIdHash
:
1845724124
InScenePlacedSourceGlobalObjectIdHash
:
0
DeferredDespawnTick
:
0
Ownership
:
1
AlwaysReplicateAsRoot
:
0
SynchronizeTransform
:
1
ActiveSceneSynchronization
:
0
SceneMigrationSynchronization
:
1
SpawnWithObservers
:
1
DontDestroyWithOwner
:
0
AutoObjectParentSync
:
1
SyncOwnerTransformWhenParented
:
1
AllowOwnerToParent
:
0
---
!u!114
&1126594263064233863
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -537,6 +562,7 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
c116b055ac29f0f4b8d54ba158c620e0
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Assembly-CSharp::AnimalAi
ShowTopMostFoldoutHeaderGroup
:
1
currentState
:
0
debugMode
:
0
---
!u!114
&4268953564234010434
...
...
@@ -570,31 +596,8 @@ MonoBehaviour:
healthColor
:
{
r
:
0
,
g
:
0.8039216
,
b
:
0.043137256
,
a
:
1
}
healthBackgroundColor
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
dieParticleSystem
:
{
fileID
:
7666945456229301054
}
---
!u!114
&5598616148842523305
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1677546864663295365
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
d5a57f767e5e46a458fc5d3c628d0cbb
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Unity.Netcode.Runtime::Unity.Netcode.NetworkObject
GlobalObjectIdHash
:
0
InScenePlacedSourceGlobalObjectIdHash
:
0
DeferredDespawnTick
:
0
Ownership
:
1
AlwaysReplicateAsRoot
:
0
SynchronizeTransform
:
1
ActiveSceneSynchronization
:
0
SceneMigrationSynchronization
:
1
SpawnWithObservers
:
1
DontDestroyWithOwner
:
0
AutoObjectParentSync
:
1
SyncOwnerTransformWhenParented
:
1
AllowOwnerToParent
:
0
_healthCounts
:
m_InternalValue
:
0
---
!u!114
&8602419029893464424
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -623,7 +626,7 @@ MonoBehaviour:
TickSyncChildren
:
0
UseUnreliableDeltas
:
0
SyncPositionX
:
1
SyncPositionY
:
1
SyncPositionY
:
0
SyncPositionZ
:
1
SyncRotAngleX
:
1
SyncRotAngleY
:
1
...
...
Assets/_project/Prefabs/Animals/Desert Animals/3_Snake.prefab
View file @
c831d64b
...
...
@@ -75,10 +75,10 @@ GameObject:
-
component
:
{
fileID
:
8656619858840122932
}
-
component
:
{
fileID
:
6248843544976465174
}
-
component
:
{
fileID
:
4644918537638395552
}
-
component
:
{
fileID
:
5355227569531775110
}
-
component
:
{
fileID
:
4822465631271738262
}
-
component
:
{
fileID
:
2124509925014609588
}
-
component
:
{
fileID
:
7977733509209312240
}
-
component
:
{
fileID
:
5355227569531775110
}
-
component
:
{
fileID
:
5677288889425026893
}
-
component
:
{
fileID
:
7721228240351520642
}
m_Layer
:
3
...
...
@@ -172,6 +172,31 @@ BoxCollider:
serializedVersion
:
3
m_Size
:
{
x
:
0.89796656
,
y
:
0.46821845
,
z
:
4.715854
}
m_Center
:
{
x
:
1.7936103e-16
,
y
:
0.09479064
,
z
:
0.043871403
}
---
!u!114
&5355227569531775110
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
873965636843474627
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
d5a57f767e5e46a458fc5d3c628d0cbb
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Unity.Netcode.Runtime::Unity.Netcode.NetworkObject
GlobalObjectIdHash
:
2862273332
InScenePlacedSourceGlobalObjectIdHash
:
0
DeferredDespawnTick
:
0
Ownership
:
1
AlwaysReplicateAsRoot
:
0
SynchronizeTransform
:
1
ActiveSceneSynchronization
:
0
SceneMigrationSynchronization
:
1
SpawnWithObservers
:
1
DontDestroyWithOwner
:
0
AutoObjectParentSync
:
1
SyncOwnerTransformWhenParented
:
1
AllowOwnerToParent
:
0
---
!u!114
&4822465631271738262
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -184,6 +209,7 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
c116b055ac29f0f4b8d54ba158c620e0
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Assembly-CSharp::AnimalAi
ShowTopMostFoldoutHeaderGroup
:
1
currentState
:
0
debugMode
:
0
---
!u!114
&2124509925014609588
...
...
@@ -217,31 +243,8 @@ MonoBehaviour:
healthColor
:
{
r
:
0
,
g
:
0.8039216
,
b
:
0.043137256
,
a
:
1
}
healthBackgroundColor
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
dieParticleSystem
:
{
fileID
:
7213738999383922802
}
---
!u!114
&5355227569531775110
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
873965636843474627
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
d5a57f767e5e46a458fc5d3c628d0cbb
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Unity.Netcode.Runtime::Unity.Netcode.NetworkObject
GlobalObjectIdHash
:
0
InScenePlacedSourceGlobalObjectIdHash
:
0
DeferredDespawnTick
:
0
Ownership
:
1
AlwaysReplicateAsRoot
:
0
SynchronizeTransform
:
1
ActiveSceneSynchronization
:
0
SceneMigrationSynchronization
:
1
SpawnWithObservers
:
1
DontDestroyWithOwner
:
0
AutoObjectParentSync
:
1
SyncOwnerTransformWhenParented
:
1
AllowOwnerToParent
:
0
_healthCounts
:
m_InternalValue
:
0
---
!u!114
&5677288889425026893
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -270,7 +273,7 @@ MonoBehaviour:
TickSyncChildren
:
0
UseUnreliableDeltas
:
0
SyncPositionX
:
1
SyncPositionY
:
1
SyncPositionY
:
0
SyncPositionZ
:
1
SyncRotAngleX
:
1
SyncRotAngleY
:
1
...
...
Assets/_project/Prefabs/Animals/Forest Animals/1_Bear.prefab
View file @
c831d64b
...
...
@@ -1590,10 +1590,10 @@ GameObject:
-
component
:
{
fileID
:
1757435605456235488
}
-
component
:
{
fileID
:
7312363185117120247
}
-
component
:
{
fileID
:
15944340492752391
}
-
component
:
{
fileID
:
9218131098084809687
}
-
component
:
{
fileID
:
4587217831811207212
}
-
component
:
{
fileID
:
1812193164498966169
}
-
component
:
{
fileID
:
2096040867519590702
}
-
component
:
{
fileID
:
9218131098084809687
}
-
component
:
{
fileID
:
9183291462547310532
}
-
component
:
{
fileID
:
8478630006387921373
}
m_Layer
:
3
...
...
@@ -1687,6 +1687,31 @@ BoxCollider:
serializedVersion
:
3
m_Size
:
{
x
:
1.5351193
,
y
:
2.421027
,
z
:
1.955709
}
m_Center
:
{
x
:
-2.713261e-17
,
y
:
1.0224959
,
z
:
-0.009721786
}
---
!u!114
&9218131098084809687
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
7987493137821725887
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
d5a57f767e5e46a458fc5d3c628d0cbb
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Unity.Netcode.Runtime::Unity.Netcode.NetworkObject
GlobalObjectIdHash
:
2646135484
InScenePlacedSourceGlobalObjectIdHash
:
0
DeferredDespawnTick
:
0
Ownership
:
1
AlwaysReplicateAsRoot
:
0
SynchronizeTransform
:
1
ActiveSceneSynchronization
:
0
SceneMigrationSynchronization
:
1
SpawnWithObservers
:
1
DontDestroyWithOwner
:
0
AutoObjectParentSync
:
1
SyncOwnerTransformWhenParented
:
1
AllowOwnerToParent
:
0
---
!u!114
&4587217831811207212
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -1699,6 +1724,7 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
c116b055ac29f0f4b8d54ba158c620e0
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Assembly-CSharp::AnimalAi
ShowTopMostFoldoutHeaderGroup
:
1
currentState
:
0
debugMode
:
0
---
!u!114
&1812193164498966169
...
...
@@ -1732,31 +1758,8 @@ MonoBehaviour:
healthColor
:
{
r
:
0
,
g
:
0.8039216
,
b
:
0.043137256
,
a
:
1
}
healthBackgroundColor
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
dieParticleSystem
:
{
fileID
:
8856589872205351049
}
---
!u!114
&9218131098084809687
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
7987493137821725887
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
d5a57f767e5e46a458fc5d3c628d0cbb
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Unity.Netcode.Runtime::Unity.Netcode.NetworkObject
GlobalObjectIdHash
:
0
InScenePlacedSourceGlobalObjectIdHash
:
0
DeferredDespawnTick
:
0
Ownership
:
1
AlwaysReplicateAsRoot
:
0
SynchronizeTransform
:
1
ActiveSceneSynchronization
:
0
SceneMigrationSynchronization
:
1
SpawnWithObservers
:
1
DontDestroyWithOwner
:
0
AutoObjectParentSync
:
1
SyncOwnerTransformWhenParented
:
1
AllowOwnerToParent
:
0
_healthCounts
:
m_InternalValue
:
0
---
!u!114
&9183291462547310532
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -1785,7 +1788,7 @@ MonoBehaviour:
TickSyncChildren
:
0
UseUnreliableDeltas
:
0
SyncPositionX
:
1
SyncPositionY
:
1
SyncPositionY
:
0
SyncPositionZ
:
1
SyncRotAngleX
:
1
SyncRotAngleY
:
1
...
...
Assets/_project/Prefabs/Animals/Forest Animals/2_Monkey.prefab
View file @
c831d64b
...
...
@@ -3203,10 +3203,10 @@ GameObject:
-
component
:
{
fileID
:
6421579595040200206
}
-
component
:
{
fileID
:
8443430516392832290
}
-
component
:
{
fileID
:
7978715722325493906
}
-
component
:
{
fileID
:
4102980035606371738
}
-
component
:
{
fileID
:
3783874149540798066
}
-
component
:
{
fileID
:
40797814380045437
}
-
component
:
{
fileID
:
5564318125892087809
}
-
component
:
{
fileID
:
4102980035606371738
}
-
component
:
{
fileID
:
7864252769378625448
}
-
component
:
{
fileID
:
6881622347556982677
}
m_Layer
:
3
...
...
@@ -3300,6 +3300,31 @@ BoxCollider:
serializedVersion
:
3
m_Size
:
{
x
:
1.5351193
,
y
:
1.0282495
,
z
:
0.9859204
}
m_Center
:
{
x
:
-2.7132186e-17
,
y
:
0.4289297
,
z
:
-0.009721756
}
---
!u!114
&4102980035606371738
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
7193057044126680390
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
d5a57f767e5e46a458fc5d3c628d0cbb
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Unity.Netcode.Runtime::Unity.Netcode.NetworkObject
GlobalObjectIdHash
:
2774518697
InScenePlacedSourceGlobalObjectIdHash
:
0
DeferredDespawnTick
:
0
Ownership
:
1
AlwaysReplicateAsRoot
:
0
SynchronizeTransform
:
1
ActiveSceneSynchronization
:
0
SceneMigrationSynchronization
:
1
SpawnWithObservers
:
1
DontDestroyWithOwner
:
0
AutoObjectParentSync
:
1
SyncOwnerTransformWhenParented
:
1
AllowOwnerToParent
:
0
---
!u!114
&3783874149540798066
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -3312,6 +3337,7 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
c116b055ac29f0f4b8d54ba158c620e0
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Assembly-CSharp::AnimalAi
ShowTopMostFoldoutHeaderGroup
:
1
currentState
:
0
debugMode
:
0
---
!u!114
&40797814380045437
...
...
@@ -3345,31 +3371,8 @@ MonoBehaviour:
healthColor
:
{
r
:
0
,
g
:
0.8039216
,
b
:
0.043137256
,
a
:
1
}
healthBackgroundColor
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
dieParticleSystem
:
{
fileID
:
2289348640615392363
}
---
!u!114
&4102980035606371738
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
7193057044126680390
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
d5a57f767e5e46a458fc5d3c628d0cbb
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Unity.Netcode.Runtime::Unity.Netcode.NetworkObject
GlobalObjectIdHash
:
0
InScenePlacedSourceGlobalObjectIdHash
:
0
DeferredDespawnTick
:
0
Ownership
:
1
AlwaysReplicateAsRoot
:
0
SynchronizeTransform
:
1
ActiveSceneSynchronization
:
0
SceneMigrationSynchronization
:
1
SpawnWithObservers
:
1
DontDestroyWithOwner
:
0
AutoObjectParentSync
:
1
SyncOwnerTransformWhenParented
:
1
AllowOwnerToParent
:
0
_healthCounts
:
m_InternalValue
:
0
---
!u!114
&7864252769378625448
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -3398,7 +3401,7 @@ MonoBehaviour:
TickSyncChildren
:
0
UseUnreliableDeltas
:
0
SyncPositionX
:
1
SyncPositionY
:
1
SyncPositionY
:
0
SyncPositionZ
:
1
SyncRotAngleX
:
1
SyncRotAngleY
:
1
...
...
Assets/_project/Prefabs/Animals/Ice Animals/1_Penguin.prefab
View file @
c831d64b
...
...
@@ -688,10 +688,10 @@ GameObject:
-
component
:
{
fileID
:
2604803186513422814
}
-
component
:
{
fileID
:
2054312538871420729
}
-
component
:
{
fileID
:
2722597655954255770
}
-
component
:
{
fileID
:
7402198531555784763
}
-
component
:
{
fileID
:
3092277464417715587
}
-
component
:
{
fileID
:
313242795030673799
}
-
component
:
{
fileID
:
8323765429530532640
}
-
component
:
{
fileID
:
7402198531555784763
}
-
component
:
{
fileID
:
1423116922813539718
}
-
component
:
{
fileID
:
1852338244867861846
}
m_Layer
:
3
...
...
@@ -785,6 +785,31 @@ BoxCollider:
serializedVersion
:
3
m_Size
:
{
x
:
0.7342883
,
y
:
1.3076124
,
z
:
0.9859204
}
m_Center
:
{
x
:
-2.7132186e-17
,
y
:
0.56861115
,
z
:
-0.009721756
}
---
!u!114
&7402198531555784763
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
3824715583433605288
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
d5a57f767e5e46a458fc5d3c628d0cbb
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Unity.Netcode.Runtime::Unity.Netcode.NetworkObject
GlobalObjectIdHash
:
410683681
InScenePlacedSourceGlobalObjectIdHash
:
0
DeferredDespawnTick
:
0
Ownership
:
1
AlwaysReplicateAsRoot
:
0
SynchronizeTransform
:
1
ActiveSceneSynchronization
:
0
SceneMigrationSynchronization
:
1
SpawnWithObservers
:
1
DontDestroyWithOwner
:
0
AutoObjectParentSync
:
1
SyncOwnerTransformWhenParented
:
1
AllowOwnerToParent
:
0
---
!u!114
&3092277464417715587
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -797,6 +822,7 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
c116b055ac29f0f4b8d54ba158c620e0
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Assembly-CSharp::AnimalAi
ShowTopMostFoldoutHeaderGroup
:
1
currentState
:
0
debugMode
:
0
---
!u!114
&313242795030673799
...
...
@@ -830,31 +856,8 @@ MonoBehaviour:
healthColor
:
{
r
:
0
,
g
:
0.8039216
,
b
:
0.043137256
,
a
:
1
}
healthBackgroundColor
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
dieParticleSystem
:
{
fileID
:
3651862403165494120
}
---
!u!114
&7402198531555784763
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
3824715583433605288
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
d5a57f767e5e46a458fc5d3c628d0cbb
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Unity.Netcode.Runtime::Unity.Netcode.NetworkObject
GlobalObjectIdHash
:
0
InScenePlacedSourceGlobalObjectIdHash
:
0
DeferredDespawnTick
:
0
Ownership
:
1
AlwaysReplicateAsRoot
:
0
SynchronizeTransform
:
1
ActiveSceneSynchronization
:
0
SceneMigrationSynchronization
:
1
SpawnWithObservers
:
1
DontDestroyWithOwner
:
0
AutoObjectParentSync
:
1
SyncOwnerTransformWhenParented
:
1
AllowOwnerToParent
:
0
_healthCounts
:
m_InternalValue
:
0
---
!u!114
&1423116922813539718
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -883,7 +886,7 @@ MonoBehaviour:
TickSyncChildren
:
0
UseUnreliableDeltas
:
0
SyncPositionX
:
1
SyncPositionY
:
1
SyncPositionY
:
0
SyncPositionZ
:
1
SyncRotAngleX
:
1
SyncRotAngleY
:
1
...
...
Assets/_project/Prefabs/Animals/Ice Animals/1_PolarBear.prefab
View file @
c831d64b
...
...
@@ -430,10 +430,10 @@ GameObject:
-
component
:
{
fileID
:
5946812577701127397
}
-
component
:
{
fileID
:
8096916219475117251
}
-
component
:
{
fileID
:
1518516700003827951
}
-
component
:
{
fileID
:
3279209143921719585
}
-
component
:
{
fileID
:
3014964892884752573
}
-
component
:
{
fileID
:
1868278021961101916
}
-
component
:
{
fileID
:
8329710285400560417
}
-
component
:
{
fileID
:
3279209143921719585
}
-
component
:
{
fileID
:
4785301330124650245
}
-
component
:
{
fileID
:
8098808694983725260
}
m_Layer
:
3
...
...
@@ -527,6 +527,31 @@ BoxCollider:
serializedVersion
:
3
m_Size
:
{
x
:
1.5351193
,
y
:
2.421027
,
z
:
1.955709
}
m_Center
:
{
x
:
-2.713261e-17
,
y
:
1.0224959
,
z
:
-0.009721786
}
---
!u!114
&3279209143921719585
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
2175243213733850576
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
d5a57f767e5e46a458fc5d3c628d0cbb
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Unity.Netcode.Runtime::Unity.Netcode.NetworkObject
GlobalObjectIdHash
:
480326514
InScenePlacedSourceGlobalObjectIdHash
:
0
DeferredDespawnTick
:
0
Ownership
:
1
AlwaysReplicateAsRoot
:
0
SynchronizeTransform
:
1
ActiveSceneSynchronization
:
0
SceneMigrationSynchronization
:
1
SpawnWithObservers
:
1
DontDestroyWithOwner
:
0
AutoObjectParentSync
:
1
SyncOwnerTransformWhenParented
:
1
AllowOwnerToParent
:
0
---
!u!114
&3014964892884752573
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -539,6 +564,7 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
c116b055ac29f0f4b8d54ba158c620e0
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Assembly-CSharp::AnimalAi
ShowTopMostFoldoutHeaderGroup
:
1
currentState
:
0
debugMode
:
0
---
!u!114
&1868278021961101916
...
...
@@ -572,31 +598,8 @@ MonoBehaviour:
healthColor
:
{
r
:
0
,
g
:
0.8039216
,
b
:
0.043137256
,
a
:
1
}
healthBackgroundColor
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
dieParticleSystem
:
{
fileID
:
1212170556263768825
}
---
!u!114
&3279209143921719585
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
2175243213733850576
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
d5a57f767e5e46a458fc5d3c628d0cbb
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Unity.Netcode.Runtime::Unity.Netcode.NetworkObject
GlobalObjectIdHash
:
0
InScenePlacedSourceGlobalObjectIdHash
:
0
DeferredDespawnTick
:
0
Ownership
:
1
AlwaysReplicateAsRoot
:
0
SynchronizeTransform
:
1
ActiveSceneSynchronization
:
0
SceneMigrationSynchronization
:
1
SpawnWithObservers
:
1
DontDestroyWithOwner
:
0
AutoObjectParentSync
:
1
SyncOwnerTransformWhenParented
:
1
AllowOwnerToParent
:
0
_healthCounts
:
m_InternalValue
:
0
---
!u!114
&4785301330124650245
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -625,7 +628,7 @@ MonoBehaviour:
TickSyncChildren
:
0
UseUnreliableDeltas
:
0
SyncPositionX
:
1
SyncPositionY
:
1
SyncPositionY
:
0
SyncPositionZ
:
1
SyncRotAngleX
:
1
SyncRotAngleY
:
1
...
...
Assets/_project/Prefabs/Players/Player.prefab
View file @
c831d64b
...
...
@@ -31,6 +31,7 @@ RectTransform:
m_ConstrainProportionsScale
:
0
m_Children
:
-
{
fileID
:
3729816966131146957
}
-
{
fileID
:
4872615058239913563
}
m_Father
:
{
fileID
:
7983808192438563087
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0
,
y
:
0
}
...
...
@@ -141,7 +142,7 @@ MonoBehaviour:
m_OnCullStateChanged
:
m_PersistentCalls
:
m_Calls
:
[]
m_text
:
m_text
:
sdasd
m_isRightToLeft
:
0
m_fontAsset
:
{
fileID
:
11400000
,
guid
:
8f586378b4e144a9851e7b34d9b748ee
,
type
:
2
}
m_sharedMaterial
:
{
fileID
:
2180264
,
guid
:
8f586378b4e144a9851e7b34d9b748ee
,
type
:
2
}
...
...
@@ -215,7 +216,7 @@ MonoBehaviour:
m_maskOffset
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
0
}
preserveNumbers
:
0
farsi
:
1
originalText
:
originalText
:
sdasd
fixTags
:
1
forceFix
:
0
---
!u!1
&1365881710000785033
...
...
@@ -245,7 +246,7 @@ RectTransform:
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1365881710000785033
}
m_LocalRotation
:
{
x
:
-0
,
y
:
0.50800216
,
z
:
-0
,
w
:
0.8613558
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_ConstrainProportionsScale
:
0
...
...
@@ -256,7 +257,7 @@ RectTransform:
m_AnchorMin
:
{
x
:
0
,
y
:
0
}
m_AnchorMax
:
{
x
:
0
,
y
:
0
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
2.31
}
m_SizeDelta
:
{
x
:
2.5
,
y
:
1.25
}
m_SizeDelta
:
{
x
:
5.51
,
y
:
1.25
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!223
&8598711961657260565
Canvas
:
...
...
@@ -1006,6 +1007,10 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
04fec1f29c777934d9d0ad6f3f05433b
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Assembly-CSharp::PlayerScore
ShowTopMostFoldoutHeaderGroup
:
1
scoreText
:
{
fileID
:
1602794761662568674
}
_score
:
m_InternalValue
:
0
---
!u!114
&7066935419696185382
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -1035,9 +1040,11 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
5c4e82e0b8d63af439665839bca25323
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Assembly-CSharp::HumanHealth
ShowTopMostFoldoutHeaderGroup
:
1
maxHealth
:
5
slider
:
{
fileID
:
3878899430567240982
}
fadeCanves
:
{
fileID
:
7818106191255021760
}
_currentHealth
:
0
---
!u!114
&-1907017260301152933
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -1121,8 +1128,41 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
Assembly-CSharp::PlayerDetails
ShowTopMostFoldoutHeaderGroup
:
1
<PlayerName>k__BackingField
:
Abdo
<PlayerImage>k__BackingField
:
{
fileID
:
0
}
PlayerName
:
m_InternalValue
:
utf8LengthInBytes
:
7
bytes
:
offset0000
:
byte0000
:
85
byte0001
:
110
byte0002
:
107
byte0003
:
110
byte0004
:
111
byte0005
:
119
byte0006
:
110
byte0007
:
0
byte0008
:
0
byte0009
:
0
byte0010
:
0
byte0011
:
0
byte0012
:
0
byte0013
:
0
byte0014
:
0
byte0015
:
0
byte0016
:
0
byte0017
:
0
byte0018
:
0
byte0019
:
0
byte0020
:
0
byte0021
:
0
byte0022
:
0
byte0023
:
0
byte0024
:
0
byte0025
:
0
byte0026
:
0
byte0027
:
0
byte0028
:
0
byte0029
:
0
nameText
:
{
fileID
:
66502904887126772
}
---
!u!1
&4692262640871086189
GameObject
:
...
...
@@ -1492,6 +1532,148 @@ Animator:
m_AllowConstantClipSamplingOptimization
:
1
m_KeepAnimatorStateOnDisable
:
0
m_WriteDefaultValuesOnDisable
:
0
---
!u!1
&6171535495631953954
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
4872615058239913563
}
-
component
:
{
fileID
:
3589613712611635919
}
-
component
:
{
fileID
:
1602794761662568674
}
m_Layer
:
5
m_Name
:
Score
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!224
&4872615058239913563
RectTransform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
6171535495631953954
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
-0.000015258793
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_ConstrainProportionsScale
:
0
m_Children
:
[]
m_Father
:
{
fileID
:
113484537283303158
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0
,
y
:
0
}
m_AnchorMax
:
{
x
:
1
,
y
:
1
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
1.35
}
m_SizeDelta
:
{
x
:
0
,
y
:
0
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!222
&3589613712611635919
CanvasRenderer
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
6171535495631953954
}
m_CullTransparentMesh
:
1
---
!u!114
&1602794761662568674
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
6171535495631953954
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
b9839c2d141529145a431aef4d757ff3
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
RTLTMPro::RTLTMPro.RTLTextMeshPro
m_Material
:
{
fileID
:
0
}
m_Color
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
m_RaycastTarget
:
1
m_RaycastPadding
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
0
}
m_Maskable
:
1
m_OnCullStateChanged
:
m_PersistentCalls
:
m_Calls
:
[]
m_text
:
m_isRightToLeft
:
0
m_fontAsset
:
{
fileID
:
11400000
,
guid
:
8f586378b4e144a9851e7b34d9b748ee
,
type
:
2
}
m_sharedMaterial
:
{
fileID
:
2180264
,
guid
:
8f586378b4e144a9851e7b34d9b748ee
,
type
:
2
}
m_fontSharedMaterials
:
[]
m_fontMaterial
:
{
fileID
:
0
}
m_fontMaterials
:
[]
m_fontColor32
:
serializedVersion
:
2
rgba
:
4279640005
m_fontColor
:
{
r
:
0.7735849
,
g
:
0.12191443
,
b
:
0.08611599
,
a
:
1
}
m_enableVertexGradient
:
0
m_colorMode
:
3
m_fontColorGradient
:
topLeft
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
topRight
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
bottomLeft
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
bottomRight
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
m_fontColorGradientPreset
:
{
fileID
:
0
}
m_spriteAsset
:
{
fileID
:
0
}
m_tintAllSprites
:
0
m_StyleSheet
:
{
fileID
:
0
}
m_TextStyleHashCode
:
-1183493901
m_overrideHtmlColors
:
0
m_faceColor
:
serializedVersion
:
2
rgba
:
4294967295
m_fontSize
:
0.5
m_fontSizeBase
:
0.5
m_fontWeight
:
400
m_enableAutoSizing
:
0
m_fontSizeMin
:
18
m_fontSizeMax
:
72
m_fontStyle
:
1
m_HorizontalAlignment
:
2
m_VerticalAlignment
:
512
m_textAlignment
:
65535
m_characterSpacing
:
0
m_characterHorizontalScale
:
1
m_wordSpacing
:
0
m_lineSpacing
:
0
m_lineSpacingMax
:
0
m_paragraphSpacing
:
0
m_charWidthMaxAdj
:
0
m_TextWrappingMode
:
1
m_wordWrappingRatios
:
0.4
m_overflowMode
:
0
m_linkedTextComponent
:
{
fileID
:
0
}
parentLinkedComponent
:
{
fileID
:
0
}
m_enableKerning
:
0
m_ActiveFontFeatures
:
6e72656b
m_enableExtraPadding
:
0
checkPaddingRequired
:
0
m_isRichText
:
1
m_EmojiFallbackSupport
:
1
m_parseCtrlCharacters
:
1
m_isOrthographic
:
1
m_isCullingEnabled
:
0
m_horizontalMapping
:
0
m_verticalMapping
:
0
m_uvLineOffset
:
0
m_geometrySortingOrder
:
0
m_IsTextObjectScaleStatic
:
0
m_VertexBufferAutoSizeReduction
:
0
m_useMaxVisibleDescender
:
1
m_pageToDisplay
:
1
m_margin
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
0
}
m_isUsingLegacyAnimationComponent
:
0
m_isVolumetricText
:
0
m_hasFontAssetChanged
:
0
m_baseMaterial
:
{
fileID
:
0
}
m_maskOffset
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
0
}
preserveNumbers
:
0
farsi
:
1
originalText
:
fixTags
:
1
forceFix
:
0
---
!u!1
&6196460427515695604
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -1595,12 +1777,6 @@ MonoBehaviour:
m_EditorClassIdentifier
:
Assembly-CSharp::Fade
fadeOnInStart
:
0
fadeOutInStart
:
0
onFinish
:
m_PersistentCalls
:
m_Calls
:
[]
onStart
:
m_PersistentCalls
:
m_Calls
:
[]
FadeDuration
:
0.4
---
!u!1
&6873664302519058081
GameObject
:
...
...
Assets/_project/Scenes/Game.unity
View file @
c831d64b
This diff is collapsed.
Click to expand it.
Assets/_project/Scenes/LobbyScene.unity
View file @
c831d64b
...
...
@@ -849,6 +849,111 @@ CanvasRenderer:
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
341584728
}
m_CullTransparentMesh
:
1
---
!u!1
&447866897
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
447866900
}
-
component
:
{
fileID
:
447866899
}
-
component
:
{
fileID
:
447866898
}
m_Layer
:
0
m_Name
:
NetworkManager
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!114
&447866898
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
447866897
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
6960e84d07fb87f47956e7a81d71c4e6
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Unity.Netcode.Runtime::Unity.Netcode.Transports.UTP.UnityTransport
m_ProtocolType
:
0
m_UseWebSockets
:
1
m_UseEncryption
:
0
m_MaxPacketQueueSize
:
128
m_MaxPayloadSize
:
6144
m_HeartbeatTimeoutMS
:
500
m_ConnectTimeoutMS
:
1000
m_MaxConnectAttempts
:
60
m_DisconnectTimeoutMS
:
30000
ConnectionData
:
Address
:
127.0.0.1
Port
:
7777
ServerListenAddress
:
127.0.0.1
ClientBindPort
:
0
DebugSimulator
:
PacketDelayMS
:
0
PacketJitterMS
:
0
PacketDropRate
:
0
---
!u!114
&447866899
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
447866897
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
593a2fe42fa9d37498c96f9a383b6521
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Unity.Netcode.Runtime::Unity.Netcode.NetworkManager
NetworkManagerExpanded
:
0
NetworkConfig
:
ProtocolVersion
:
0
NetworkTransport
:
{
fileID
:
447866898
}
PlayerPrefab
:
{
fileID
:
4691952305033069124
,
guid
:
5922d3cf9c6f4784f8277e3d39518356
,
type
:
3
}
Prefabs
:
NetworkPrefabsLists
:
-
{
fileID
:
11400000
,
guid
:
5d8ee9d8b99a6e845a9710aafe141857
,
type
:
2
}
TickRate
:
30
ClientConnectionBufferTimeout
:
10
ConnectionApproval
:
1
ConnectionData
:
EnableTimeResync
:
0
TimeResyncInterval
:
30
EnsureNetworkVariableLengthSafety
:
0
EnableSceneManagement
:
1
ForceSamePrefabs
:
1
RecycleNetworkIds
:
1
NetworkIdRecycleDelay
:
120
RpcHashSize
:
0
LoadSceneTimeOut
:
120
SpawnTimeout
:
10
EnableNetworkLogs
:
1
NetworkTopology
:
0
UseCMBService
:
0
AutoSpawnPlayerPrefabClientSide
:
1
NetworkProfilingMetrics
:
1
OldPrefabList
:
[]
RunInBackground
:
1
LogLevel
:
1
---
!u!4
&447866900
Transform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
447866897
}
serializedVersion
:
2
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
334.19205
,
y
:
111.9783
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_ConstrainProportionsScale
:
0
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!1
&555826374
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -3251,11 +3356,11 @@ RectTransform:
m_LocalScale
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_ConstrainProportionsScale
:
0
m_Children
:
-
{
fileID
:
333994248
}
-
{
fileID
:
1873039633
}
-
{
fileID
:
605812568
}
-
{
fileID
:
1301690833
}
-
{
fileID
:
105771330
}
-
{
fileID
:
333994248
}
m_Father
:
{
fileID
:
564749607
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0
,
y
:
0
}
...
...
@@ -4028,6 +4133,52 @@ CanvasRenderer:
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
2069505147
}
m_CullTransparentMesh
:
1
---
!u!1
&2083573901
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
2083573902
}
-
component
:
{
fileID
:
2083573903
}
m_Layer
:
0
m_Name
:
ApprovRequest
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!4
&2083573902
Transform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
2083573901
}
serializedVersion
:
2
m_LocalRotation
:
{
x
:
-0
,
y
:
-0
,
z
:
-0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_ConstrainProportionsScale
:
0
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!114
&2083573903
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
2083573901
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
efb908ecd773e2e49b0fb30f532e07f9
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Assembly-CSharp::ApprovRequest
<playerPrefab>k__BackingField
:
{
fileID
:
-5192139548446471021
,
guid
:
5922d3cf9c6f4784f8277e3d39518356
,
type
:
3
}
networkManager
:
{
fileID
:
447866899
}
---
!u!1
&2083683282
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -4245,3 +4396,5 @@ SceneRoots:
m_ObjectHideFlags
:
0
m_Roots
:
-
{
fileID
:
1887961657
}
-
{
fileID
:
447866900
}
-
{
fileID
:
2083573902
}
Assets/_project/Scripts/Core/AnimalsQuestionGenerator.cs
View file @
c831d64b
...
...
@@ -29,7 +29,7 @@ public class AnimalsQuestionGenerator : MonoBehaviour
prevQuestion
=
currentQuestionText
;
currentQuestionText
=
currentQuestionText
.
Replace
(
"_"
,
" "
);
//
GameHUD.Instance.Question.Value = currentQuestionText;
GameHUD
.
Instance
.
Question
.
Value
=
currentQuestionText
;
}
private
string
BuildQuestionString
()
{
...
...
Assets/_project/Scripts/Core/Manager/AnimalsSpawner.cs
View file @
c831d64b
...
...
@@ -81,8 +81,8 @@ public class AnimalsSpawner : MonoBehaviour
if
(
NavMesh
.
SamplePosition
(
spwanPos
,
out
NavMeshHit
hit
,
2
,
NavMesh
.
AllAreas
))
{
GameObject
animalGameobject
=
Instantiate
(
animal
,
hit
.
position
,
Quaternion
.
identity
,
animalsParent
);
animalGameobject
.
GetComponent
<
AnimalDetails
>().
CorrectAnimal
(
isCorrect
);
animalGameobject
.
GetComponent
<
NetworkObject
>().
Spawn
();
animalGameobject
.
GetComponent
<
AnimalDetails
>().
isCorrect
.
Value
=
isCorrect
;
}
}
void
OnDrawGizmos
()
...
...
Assets/_project/Scripts/Network/Connection/HandlePlayersConnection.cs
View file @
c831d64b
using
System.Collections
;
using
System.Collections
;
using
Unity.Netcode
;
using
UnityEngine
;
public
class
HandlePlayersConnection
:
Mono
Behaviour
public
class
HandlePlayersConnection
:
Network
Behaviour
{
[
SerializeField
]
int
maxPlayer
;
[
SerializeField
]
GameManager
gameManagerScript
;
[
SerializeField
]
GameManager
gameManagerScript
;
[
SerializeField
]
Fade
fadeScript
;
[
SerializeField
]
ApprovRequest
approvRequest
;
public
override
void
OnNetworkSpawn
()
{
approvRequest
=
ApprovRequest
.
Instance
;
void
Start
()
{
StartCoroutine
(
CheckConnectionPlayers
());
StartCoroutine
(
SpawnPlayer
());
}
IEnumerator
CheckConnectionPlayers
()
IEnumerator
SpawnPlayer
()
{
WaitForSeconds
waitForSeconds
=
new
WaitForSeconds
(
1
);
while
(
NetworkManager
.
Singleton
.
ConnectedClients
.
Count
!=
2
)
yield
return
new
WaitForSeconds
(
3
);
if
(
IsServer
)
{
Debug
.
Log
(
NetworkManager
.
Singleton
.
ConnectedClients
.
Count
);
yield
return
waitForSeconds
;
foreach
(
var
item
in
approvRequest
.
clientData
)
{
NetworkObject
player
=
Instantiate
(
approvRequest
.
playerPrefab
);
player
.
SpawnAsPlayerObject
(
item
.
Key
);
player
.
GetComponent
<
PlayerDetails
>().
InitPlayerData
(
item
.
Value
);
}
}
gameManagerScript
.
gameObject
.
SetActive
(
true
);
fadeScript
.
FadeOut
();
...
...
Assets/_project/Scripts/Network/Data/ApprovRequest.cs
0 → 100644
View file @
c831d64b
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Threading.Tasks
;
using
Unity.Netcode
;
using
UnityEditor.PackageManager
;
using
UnityEngine
;
public
class
ApprovRequest
:
MonoBehaviour
{
public
static
ApprovRequest
Instance
;
public
Dictionary
<
ulong
,
PlayerData
>
clientData
{
get
;
private
set
;
}
=
new
Dictionary
<
ulong
,
PlayerData
>();
[
field
:
SerializeField
]
public
NetworkObject
playerPrefab
{
get
;
private
set
;
}
[
SerializeField
]
NetworkManager
networkManager
;
private
void
Awake
()
{
if
(
Instance
==
null
)
Instance
=
this
;
else
Destroy
(
this
);
DontDestroyOnLoad
(
this
);
networkManager
.
ConnectionApprovalCallback
=
ApprovConnection
;
}
private
void
ApprovConnection
(
NetworkManager
.
ConnectionApprovalRequest
request
,
NetworkManager
.
ConnectionApprovalResponse
response
)
{
string
bytes
=
Encoding
.
UTF8
.
GetString
(
request
.
Payload
);
PlayerData
playerData
=
JsonUtility
.
FromJson
<
PlayerData
>(
bytes
);
clientData
[
request
.
ClientNetworkId
]
=
playerData
;
response
.
Approved
=
true
;
response
.
CreatePlayerObject
=
false
;
}
}
Assets/_project/Scripts/Network/Data/ApprovRequest.cs.meta
0 → 100644
View file @
c831d64b
fileFormatVersion: 2
guid: efb908ecd773e2e49b0fb30f532e07f9
\ No newline at end of file
Assets/_project/Scripts/Network/Data/PlayerData.cs
View file @
c831d64b
using
Unity.Netcode
;
public
struct
PlayerData
:
INetworkSerializable
{
public
ulong
playerId
;
public
ulong
playerName
;
public
ulong
playerAvatar
;
using
System
;
public
void
NetworkSerialize
<
T
>(
BufferSerializer
<
T
>
serializer
)
where
T
:
IReaderWriter
{
serializer
.
SerializeValue
(
ref
playerId
);
serializer
.
SerializeValue
(
ref
playerName
)
;
serializer
.
SerializeValue
(
ref
playerAvatar
)
;
}
[Serializable]
public
class
PlayerData
{
public
string
AuthId
;
public
string
playerName
;
public
string
playerAvatar
;
}
Assets/_project/Scripts/Network/Lobby/CreateLobby.cs
View file @
c831d64b
...
...
@@ -4,6 +4,8 @@ using UnityEngine;
using
UnityEngine.UI
;
using
System.Collections.Generic
;
using
Unity.Services.Lobbies.Models
;
using
Unity.Netcode
;
using
System
;
public
class
CreateLobby
:
MonoBehaviour
{
...
...
@@ -17,6 +19,8 @@ public class CreateLobby : MonoBehaviour
{
CreateLobbyButton
.
onClick
.
AddListener
(
Create
);
_fadeWithText
=
FadeWithText
.
Instance
;
}
private
async
void
Create
()
{
...
...
Assets/_project/Scripts/Network/Lobby/LobbyRoom.cs
View file @
c831d64b
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Threading.Tasks
;
using
TMPro
;
using
Unity.Netcode
;
using
Unity.Netcode.Transports.UTP
;
using
Unity.Networking.Transport.Relay
;
using
Unity.Services.Authentication
;
using
Unity.Services.Lobbies
;
using
Unity.Services.Lobbies.Models
;
using
Unity.Services.Relay
;
using
Unity.Services.Relay.Models
;
using
UnityEngine
;
using
UnityEngine.UI
;
...
...
@@ -24,17 +29,31 @@ public class LobbyRoom : MonoBehaviour
int
_currentNPCs
;
int
_currentReadyPlayer
;
void
Start
()
{
_isOwner
=
LobbyRequest
.
_currentLobby
.
HostId
==
AuthenticationService
.
Instance
.
PlayerId
;
startButton
.
interactable
=
_isOwner
;
exitButton
.
onClick
.
AddListener
(
LeaveLobby
);
startButton
.
onClick
.
AddListener
(
CheckPlayerCount
);
ShowLobbyCode
();
_lobbyHeart
=
FindAnyObjectByType
<
LobbyHeart
>();
RefreshLobby
();
SubscribeToLobbyEvent
();
NetworkManager
.
Singleton
.
OnClientConnectedCallback
+=
OnClientConnected
;
}
private
void
OnClientConnected
(
ulong
clientId
)
{
if
(
NetworkManager
.
Singleton
.
ConnectedClients
.
Count
==
2
)
{
StartCoroutine
(
StartGameTimer
());
}
}
async
void
SubscribeToLobbyEvent
()
...
...
@@ -50,8 +69,6 @@ public class LobbyRoom : MonoBehaviour
_lobbyEvents
=
await
LobbyService
.
Instance
.
SubscribeToLobbyEventsAsync
(
LobbyRequest
.
_currentLobby
.
Id
,
lobbyEventCallbacks
);
}
private
void
LobbyDeleted
()
{
ChangeSceneManager
.
Instance
.
ChangeToMainmenuScene
();
...
...
@@ -59,11 +76,21 @@ public class LobbyRoom : MonoBehaviour
private
void
DataChanged
(
Dictionary
<
string
,
ChangedOrRemovedLobbyValue
<
DataObject
>>
obj
)
{
RefreshLobby
();
RefreshNPCs
();
// RefreshLobby();
//RefreshNPCs();
if
(!
_isOwner
)
{
if
(!
string
.
IsNullOrEmpty
(
obj
[
"AllocationCode"
].
Value
.
Value
))
{
StartClient
(
obj
[
"AllocationCode"
].
Value
.
Value
);
Debug
.
Log
(
"Start Client"
);
}
}
Debug
.
Log
(
"DataChanged"
);
}
}
private
void
PlayerDataChanged
(
Dictionary
<
int
,
Dictionary
<
string
,
ChangedOrRemovedLobbyValue
<
PlayerDataObject
>>>
obj
)
{
RefreshLobby
();
...
...
@@ -105,15 +132,23 @@ public class LobbyRoom : MonoBehaviour
}
async
void
CheckPlayerCount
()
{
if
(
_currentNPCs
+
_currentReadyPlayer
==
4
&&
_isOwner
)
Lobby
lobby
=
await
LobbyService
.
Instance
.
GetLobbyAsync
(
LobbyRequest
.
_currentLobby
.
Id
);
int
isReadyCount
=
0
;
foreach
(
Player
player
in
lobby
.
Players
)
{
if
(
player
.
Data
[
"IsReady"
].
Value
==
"True"
)
isReadyCount
++;
}
if
(
isReadyCount
==
2
)
{
startButton
.
interactable
=
true
;
startButton
.
image
.
color
=
Color
.
green
;
await
StartAllocate
();
}
}
async
Task
StartAllocate
()
{
startButton
.
interactable
=
false
;
FadeWithText
.
Instance
.
ShowMessage
(
"جاري التحميل..."
,
false
);
string
AllocationCode
=
await
AllocationRequest
.
Create
();
UpdateLobbyOptions
updateLobbyOptions
=
new
UpdateLobbyOptions
()
...
...
@@ -125,41 +160,74 @@ public class LobbyRoom : MonoBehaviour
}
};
await
LobbyRequest
.
UpdateLobby
(
updateLobbyOptions
);
}
IEnumerator
StartGameTimer
()
// Excute This to all client after
{
int
timer
=
4
;
while
(
timer
>
0
)
{
timer
--;
yield
return
new
WaitForSeconds
(
1
);
}
FadeWithText
.
Instance
.
ShowMessage
(
"جاري الدخول..."
,
false
);
if
(
_isOwner
)
{
NetworkManager
.
Singleton
.
StartHost
();
NetworkManager
.
Singleton
.
OnClientConnectedCallback
+=
PlayerConnection
;
StartHost
();
}
else
}
void
StartHost
()
{
string
authId
=
AuthenticationService
.
Instance
.
PlayerId
;
Player
currentPlayer
=
LobbyRequest
.
_currentLobby
.
Players
.
Find
(
p
=>
p
.
Id
==
authId
);
PlayerData
playerData
=
new
PlayerData
{
NetworkManager
.
Singleton
.
StartClient
();
}
AuthId
=
authId
,
playerName
=
currentPlayer
.
Data
[
"Name"
].
Value
,
playerAvatar
=
currentPlayer
.
Data
[
"AvatarIndex"
].
Value
,
};
RelayServerData
relayServerData
=
AllocationUtils
.
ToRelayServerData
(
AllocationRequest
.
_allocation
,
"wss"
);
UnityTransport
unityTransport
=
NetworkManager
.
Singleton
.
GetComponent
<
UnityTransport
>();
unityTransport
.
SetRelayServerData
(
relayServerData
);
string
data
=
JsonUtility
.
ToJson
(
playerData
);
byte
[]
dataToByte
=
Encoding
.
UTF8
.
GetBytes
(
data
);
NetworkManager
.
Singleton
.
NetworkConfig
.
ConnectionData
=
dataToByte
;
NetworkManager
.
Singleton
.
StartHost
();
}
private
void
OnDestroy
(
)
async
void
StartClient
(
string
code
)
{
if
(
NetworkManager
.
Singleton
!=
null
)
string
authId
=
AuthenticationService
.
Instance
.
PlayerId
;
Player
currentPlayer
=
LobbyRequest
.
_currentLobby
.
Players
.
Find
(
p
=>
p
.
Id
==
authId
);
PlayerData
playerData
=
new
PlayerData
{
NetworkManager
.
Singleton
.
OnClientConnectedCallback
-=
PlayerConnection
;
}
AuthId
=
authId
,
playerName
=
currentPlayer
.
Data
[
"Name"
].
Value
,
playerAvatar
=
currentPlayer
.
Data
[
"AvatarIndex"
].
Value
,
};
JoinAllocation
joinAllocation
=
await
RelayService
.
Instance
.
JoinAllocationAsync
(
code
);
RelayServerData
relayServerData
=
AllocationUtils
.
ToRelayServerData
(
joinAllocation
,
"wss"
);
UnityTransport
unityTransport
=
NetworkManager
.
Singleton
.
GetComponent
<
UnityTransport
>();
unityTransport
.
SetRelayServerData
(
relayServerData
);
string
data
=
JsonUtility
.
ToJson
(
playerData
);
byte
[]
dataToByte
=
Encoding
.
UTF8
.
GetBytes
(
data
);
NetworkManager
.
Singleton
.
NetworkConfig
.
ConnectionData
=
dataToByte
;
NetworkManager
.
Singleton
.
StartClient
();
}
private
void
PlayerConnection
(
ulong
obj
)
IEnumerator
StartGameTimer
()
{
if
(
NetworkManager
.
Singleton
.
ConnectedClients
.
Count
==
_currentReadyPlayer
)
int
timer
=
4
;
while
(
timer
>
0
)
{
NetworkManager
.
Singleton
.
SceneManager
.
LoadScene
(
"Game"
,
UnityEngine
.
SceneManagement
.
LoadSceneMode
.
Single
);
timer
--;
FadeWithText
.
Instance
.
ShowMessage
(
timer
.
ToString
(),
false
);
yield
return
new
WaitForSeconds
(
1
);
}
FadeWithText
.
Instance
.
ShowMessage
(
"جاري الدخول..."
,
false
);
yield
return
new
WaitForSeconds
(
2
);
if
(
NetworkManager
.
Singleton
.
IsServer
)
{
NetworkManager
.
Singleton
.
SceneManager
.
LoadScene
(
"Game"
,
UnityEngine
.
SceneManagement
.
LoadSceneMode
.
Single
);
}
}
private
async
void
RefreshLobby
()
{
try
...
...
@@ -177,7 +245,6 @@ public class LobbyRoom : MonoBehaviour
if
(
lobby
.
Data
.
ContainsKey
(
"NPCsCount"
))
{
npcCount
=
int
.
Parse
(
lobby
.
Data
[
"NPCsCount"
].
Value
);
Debug
.
Log
(
npcCount
);
}
foreach
(
PlayersInLobbyRoom
slots
in
playersSlot
)
...
...
@@ -240,7 +307,6 @@ public class LobbyRoom : MonoBehaviour
}
}
}
private
void
LeaveLobby
()
{
CleanupLobby
();
...
...
Assets/_project/Scripts/Network/Ui/GameHUD.cs
View file @
c831d64b
using
RTLTMPro
;
using
System
;
using
Unity.Collections
;
using
Unity.Netcode
;
using
UnityEngine
;
...
...
@@ -8,7 +9,7 @@ public class GameHUD : NetworkBehaviour
public
static
GameHUD
Instance
;
[
SerializeField
]
RTLTextMeshPro
QuestionText
;
[
field
:
SerializeField
]
public
NetworkVariable
<
string
>
Question
=
new
NetworkVariable
<
string
>(
readPerm
:
NetworkVariableReadPermission
.
Everyone
,
writePerm
:
NetworkVariableWritePermission
.
Server
);
[
field
:
SerializeField
]
public
NetworkVariable
<
FixedString512Bytes
>
Question
=
new
NetworkVariable
<
FixedString512Bytes
>(
readPerm
:
NetworkVariableReadPermission
.
Everyone
,
writePerm
:
NetworkVariableWritePermission
.
Server
);
private
void
Awake
()
{
...
...
@@ -23,9 +24,9 @@ public class GameHUD : NetworkBehaviour
Question
.
OnValueChanged
+=
DisplayQuestion
;
}
private
void
DisplayQuestion
(
string
previousValue
,
string
newValue
)
private
void
DisplayQuestion
(
FixedString512Bytes
previousValue
,
FixedString512Bytes
newValue
)
{
QuestionText
.
text
=
newValue
;
QuestionText
.
text
=
newValue
.
ToString
()
;
}
public
override
void
OnNetworkDespawn
()
{
...
...
Assets/_project/Scripts/Network/Ui/PlayersInLobbyRoom.cs
View file @
c831d64b
using
System
;
using
System
;
using
System.Threading.Tasks
;
using
TMPro
;
using
Unity.Services.Authentication
;
...
...
Assets/_project/Scripts/Network/_Requests/Allocation/AllocationRequest.cs
View file @
c831d64b
...
...
@@ -6,7 +6,7 @@ using UnityEngine;
public
static
class
AllocationRequest
{
static
Allocation
_allocation
;
public
static
Allocation
_allocation
;
public
static
async
Task
<
string
>
Create
()
{
try
...
...
Assets/_project/Scripts/Systems/Animal/AnimalAi.cs
View file @
c831d64b
using
UnityEngine
;
using
DG.Tweening
;
using
Unity.Netcode
;
using
UnityEngine
;
using
UnityEngine.AI
;
using
static
UnityEditor
.
Experimental
.
AssetDatabaseExperimental
.
AssetDatabaseCounters
;
public
class
AnimalAi
:
Mono
Behaviour
public
class
AnimalAi
:
Network
Behaviour
{
[
SerializeField
]
AnimalAiState
currentState
;
[
SerializeField
]
bool
debugMode
;
...
...
@@ -20,7 +22,7 @@ public class AnimalAi : MonoBehaviour
int
_currentAnimation
;
bool
_changeVariableOnce
;
Transform
_hunter
;
[
SerializeField
]
Transform
_hunter
;
private
void
Start
()
{
_animalProperties
=
GetComponent
<
AnimalDetails
>().
animalProperties
;
...
...
@@ -173,7 +175,7 @@ public class AnimalAi : MonoBehaviour
GetComponent
<
Collider
>().
enabled
=
false
;
transform
.
DOMoveY
(-
3
,
3
).
SetDelay
(
3
).
OnComplete
(()
=>
Destroy
(
gameObject
)).
SetEase
(
Ease
.
Linear
);
transform
.
DOMoveY
(-
3
,
3
).
SetDelay
(
3
).
OnComplete
(()
=>
Destroy
Animal
(
)).
SetEase
(
Ease
.
Linear
);
foreach
(
MonoBehaviour
scripts
in
GetComponents
<
MonoBehaviour
>())
{
...
...
@@ -184,8 +186,23 @@ public class AnimalAi : MonoBehaviour
_changeVariableOnce
=
true
;
}
}
void
DestroyAnimal
()
{
DestroyServerRpc
();
}
[
Rpc
(
SendTo
.
Server
,
InvokePermission
=
RpcInvokePermission
.
Everyone
)]
void
DestroyServerRpc
()
{
GetComponent
<
NetworkObject
>().
Despawn
();
}
void
ChangeAnimation
(
int
stateName
)
{
ChangeAnimationServerRpc
(
stateName
);
}
[
Rpc
(
SendTo
.
Server
,
InvokePermission
=
RpcInvokePermission
.
Everyone
)]
void
ChangeAnimationServerRpc
(
int
stateName
)
{
if
(
_currentAnimation
!=
0
)
_animator
.
SetBool
(
_currentAnimation
,
false
);
...
...
@@ -197,13 +214,36 @@ public class AnimalAi : MonoBehaviour
public
void
ChangeState
(
AnimalAiState
state
,
Transform
target
)
{
_agent
.
ResetPath
();
if
(
target
==
null
)
{
ChangeStateNoTargetServerRpc
(
state
);
}
else
{
ChangeStateServerRpc
(
state
,
target
.
GetComponent
<
NetworkObject
>());
}
}
[
Rpc
(
SendTo
.
Server
,
InvokePermission
=
RpcInvokePermission
.
Everyone
)]
void
ChangeStateNoTargetServerRpc
(
AnimalAiState
state
)
{
_agent
.
ResetPath
();
_changeVariableOnce
=
false
;
_hunter
=
target
;
currentState
=
state
;
}
[
Rpc
(
SendTo
.
Server
,
InvokePermission
=
RpcInvokePermission
.
Everyone
)]
void
ChangeStateServerRpc
(
AnimalAiState
state
,
NetworkObjectReference
target
)
{
if
(
target
.
TryGet
(
out
NetworkObject
networkObject
))
{
_agent
.
ResetPath
();
_changeVariableOnce
=
false
;
_hunter
=
networkObject
.
GetComponent
<
Transform
>();
currentState
=
state
;
}
}
void
SetAgentSpeed
(
float
speed
)
=>
_agent
.
speed
=
speed
;
Vector3
GetRandomPoint
()
...
...
@@ -220,13 +260,32 @@ public class AnimalAi : MonoBehaviour
{
return
NavMesh
.
SamplePosition
(
pos
,
out
NavMeshHit
hit
,
2
,
NavMesh
.
AllAreas
);
}
public
void
HitHunter
()
// call from animation attack event
{
HitHunterServerRpc
();
}
[
Rpc
(
SendTo
.
Server
,
InvokePermission
=
RpcInvokePermission
.
Everyone
)]
void
HitHunterServerRpc
()
{
HitHunterClientRpc
();
}
[
Rpc
(
SendTo
.
ClientsAndHost
)]
void
HitHunterClientRpc
()
{
if
(
_hunter
!=
null
&&
_hunter
.
TryGetComponent
<
HumanHealth
>(
out
HumanHealth
humanHealth
))
{
humanHealth
.
TakeDamage
(
this
);
}
}
public
override
void
OnNetworkDespawn
()
{
DOTween
.
Kill
(
transform
);
}
void
OnDrawGizmos
()
{
if
(
debugMode
&&
_animalProperties
!=
null
)
...
...
Assets/_project/Scripts/Systems/Animal/AnimalDetails.cs
View file @
c831d64b
using
Unity.Netcode
;
using
UnityEngine
;
public
class
AnimalDetails
:
Mono
Behaviour
public
class
AnimalDetails
:
Network
Behaviour
{
[
field
:
SerializeField
]
public
AnimalProperties
animalProperties
{
get
;
private
set
;
}
[
field
:
SerializeField
]
public
bool
isCorrect
{
get
;
private
set
;
}
public
void
CorrectAnimal
(
bool
isCorrect
)
=>
this
.
isCorrect
=
isCorrect
;
[
field
:
SerializeField
]
public
NetworkVariable
<
bool
>
isCorrect
=
new
NetworkVariable
<
bool
>(
readPerm
:
NetworkVariableReadPermission
.
Everyone
,
writePerm
:
NetworkVariableWritePermission
.
Server
);
}
Assets/_project/Scripts/Systems/Health/BodyPart.cs
View file @
c831d64b
...
...
@@ -16,7 +16,7 @@ public class BodyPart : MonoBehaviour,IDamageable
}
void
CheckIfCorrectAnimal
()
{
if
(!
_animalDetails
.
isCorrect
)
gameObject
.
layer
=
LayerMask
.
NameToLayer
(
"IncorrectAnimal"
);
if
(!
_animalDetails
.
isCorrect
.
Value
)
gameObject
.
layer
=
LayerMask
.
NameToLayer
(
"IncorrectAnimal"
);
}
public
void
TakeDamage
(
int
amount
,
RaycastWeapon
player
)
{
...
...
Assets/_project/Scripts/Systems/Health/Health.cs
View file @
c831d64b
using
System
;
using
Unity.Netcode
;
using
UnityEngine
;
using
UnityEngine.UI
;
public
class
Health
:
Mono
Behaviour
public
class
Health
:
Network
Behaviour
{
[
SerializeField
]
GameObject
healthPrefab
;
...
...
@@ -11,10 +12,10 @@ public class Health : MonoBehaviour
[
SerializeField
]
ParticleSystem
dieParticleSystem
;
int
_healthCounts
;
[
field
:
SerializeField
]
NetworkVariable
<
int
>
_healthCounts
=
new
NetworkVariable
<
int
>(
readPerm
:
NetworkVariableReadPermission
.
Everyone
,
writePerm
:
NetworkVariableWritePermission
.
Server
)
;
RaycastWeapon
_firstPlayer
;
RaycastWeapon
_lastPlayer
;
[
SerializeField
]
RaycastWeapon
_firstPlayer
;
[
SerializeField
]
RaycastWeapon
_lastPlayer
;
AnimalProperties
_animalProperties
;
bool
_isDie
;
...
...
@@ -27,12 +28,24 @@ public class Health : MonoBehaviour
}
private
void
InstantiateHealthBar
()
{
int
count
=
0
;
for
(
int
i
=
0
;
i
<
_animalProperties
.
AnimalHealth
;
i
++)
{
Instantiate
(
healthPrefab
,
healthParent
.
transform
);
_healthCounts
++;
count
++;
ChangeScoreServerRpc
(
count
);
}
}
public
override
void
OnNetworkSpawn
()
{
_healthCounts
.
OnValueChanged
+=
ChangeHealth
;
}
private
void
ChangeHealth
(
int
previousValue
,
int
newValue
)
{
ChangeColorOfHealthBar
();
}
private
void
ColoringHealthBar
()
{
for
(
int
i
=
0
;
i
<
healthParent
.
childCount
;
i
++)
...
...
@@ -45,11 +58,16 @@ public class Health : MonoBehaviour
if
(
_isDie
)
return
;
ChangeAnimalState
(
player
.
GetComponent
<
Transform
>());
HandlePlayer
(
player
);
_healthCounts
-=
amount
;
ChangeColorOfHealthBar
();
if
(
_healthCounts
<=
0
)
Die
();
HandlePlayerServerRpc
(
player
.
GetComponent
<
NetworkObject
>());
int
prevValue
=
_healthCounts
.
Value
;
ChangeScoreServerRpc
(
prevValue
-=
amount
);
if
(
_healthCounts
.
Value
<=
0
)
Die
();
}
private
void
ChangeAnimalState
(
Transform
player
)
{
if
(
_animalProperties
.
CanAttack
)
...
...
@@ -57,11 +75,21 @@ public class Health : MonoBehaviour
else
GetComponent
<
AnimalAi
>().
ChangeState
(
AnimalAiState
.
RunAway
,
player
);
}
private
void
HandlePlayer
(
RaycastWeapon
player
)
[
Rpc
(
SendTo
.
Server
,
InvokePermission
=
RpcInvokePermission
.
Everyone
)]
private
void
HandlePlayerServerRpc
(
NetworkObjectReference
player
)
{
if
(
_firstPlayer
==
null
)
_firstPlayer
=
player
;
_lastPlayer
=
player
;
HitHunterClientRpc
(
player
);
}
[
Rpc
(
SendTo
.
ClientsAndHost
)]
void
HitHunterClientRpc
(
NetworkObjectReference
player
)
{
if
(
player
.
TryGet
(
out
NetworkObject
netObj
))
{
if
(
_firstPlayer
==
null
)
_firstPlayer
=
netObj
.
GetComponent
<
RaycastWeapon
>();
_lastPlayer
=
netObj
.
GetComponent
<
RaycastWeapon
>();
}
}
private
void
ChangeColorOfHealthBar
()
{
...
...
@@ -69,7 +97,7 @@ public class Health : MonoBehaviour
{
Image
img
=
healthParent
.
GetChild
(
i
).
GetComponent
<
Image
>();
if
(
i
<
_healthCounts
)
if
(
i
<
_healthCounts
.
Value
)
img
.
color
=
healthColor
;
else
img
.
color
=
healthBackgroundColor
;
...
...
@@ -84,7 +112,7 @@ public class Health : MonoBehaviour
int
score
=
_animalProperties
.
AnimalHealth
;
score
=
GetComponent
<
AnimalDetails
>().
isCorrect
?
score
:
-
score
/
2
;
score
=
GetComponent
<
AnimalDetails
>().
isCorrect
.
Value
?
score
:
-
score
/
2
;
if
(
_firstPlayer
==
_lastPlayer
)
_firstPlayer
.
AddScore
(
score
);
...
...
@@ -94,12 +122,28 @@ public class Health : MonoBehaviour
EndRound
();
}
public
void
EndRound
()
{
EffectServerRpc
();
GetComponent
<
AnimalAi
>().
ChangeState
(
AnimalAiState
.
Die
,
null
);
}
[
Rpc
(
SendTo
.
Server
,
InvokePermission
=
RpcInvokePermission
.
Everyone
)]
void
ChangeScoreServerRpc
(
int
amout
)
{
_healthCounts
.
Value
=
amout
;
}
[
Rpc
(
SendTo
.
Server
,
InvokePermission
=
RpcInvokePermission
.
Everyone
)]
void
EffectServerRpc
()
{
EffectClientRpc
();
}
[
Rpc
(
SendTo
.
ClientsAndHost
)]
void
EffectClientRpc
()
{
if
(
dieParticleSystem
!=
null
)
dieParticleSystem
.
Play
();
healthParent
.
gameObject
.
SetActive
(
false
);
GetComponent
<
AnimalAi
>().
ChangeState
(
AnimalAiState
.
Die
,
null
);
}
}
Assets/_project/Scripts/Systems/Player/PlayerDetails.cs
View file @
c831d64b
using
RTLTMPro
;
using
RTLTMPro
;
using
System
;
using
System.Collections
;
using
TMPro
;
using
Unity.Collections
;
using
Unity.Netcode
;
...
...
@@ -7,22 +8,28 @@ using UnityEngine;
public
class
PlayerDetails
:
NetworkBehaviour
{
public
NetworkVariable
<
FixedString32Bytes
>
PlayerName
=
new
NetworkVariable
<
FixedString32Bytes
>(
"Unknown"
,
NetworkVariableReadPermission
.
Everyone
,
NetworkVariableWritePermission
.
Own
er
);
public
NetworkVariable
<
FixedString32Bytes
>
PlayerName
=
new
NetworkVariable
<
FixedString32Bytes
>(
"Unknown"
,
NetworkVariableReadPermission
.
Everyone
,
NetworkVariableWritePermission
.
Serv
er
);
[
SerializeField
]
RTLTextMeshPro
nameText
;
public
override
void
OnNetworkSpawn
(
)
public
void
InitPlayerData
(
PlayerData
playerData
)
{
PlayerName
.
OnValueChanged
+=
onNameChanged
;
if
(
IsOwner
)
if
(
IsServer
)
{
PlayerName
.
Value
=
new
FixedString32Bytes
(
PlayerPrefs
.
GetString
(
"PlayerName"
,
"Unknown"
))
;
PlayerName
.
Value
=
playerData
.
playerName
;
}
}
public
override
void
OnNetworkSpawn
()
{
PlayerName
.
OnValueChanged
+=
onNameChanged
;
onNameChanged
(
default
,
PlayerName
.
Value
);
}
public
override
void
OnNetworkDespawn
()
{
PlayerName
.
OnValueChanged
-=
onNameChanged
;
}
private
void
onNameChanged
(
FixedString32Bytes
previousValue
,
FixedString32Bytes
newValue
)
{
nameText
.
text
=
newValue
.
ToString
();
...
...
Assets/_project/Scripts/Systems/Shared/HumanHealth.cs
View file @
c831d64b
using
System
;
using
System.Collections
;
using
Unity.Netcode
;
using
Unity.VisualScripting
;
using
UnityEngine
;
using
UnityEngine.AI
;
using
UnityEngine.UI
;
public
class
HumanHealth
:
Mono
Behaviour
public
class
HumanHealth
:
Network
Behaviour
{
public
event
Action
<
bool
>
onDead
;
...
...
@@ -13,24 +14,33 @@ public class HumanHealth : MonoBehaviour
[
SerializeField
]
Slider
slider
;
[
SerializeField
]
Fade
fadeCanves
;
int
_currentHealth
;
[
field
:
SerializeField
]
int
_currentHealth
;
private
void
Start
()
{
_currentHealth
=
maxHealth
;
slider
.
maxValue
=
maxHealth
;
}
public
void
TakeDamage
(
AnimalAi
animalAi
)
{
TakeDamageServerRpc
(
animalAi
.
GetComponent
<
NetworkObject
>());
}
[
Rpc
(
SendTo
.
Owner
,
InvokePermission
=
RpcInvokePermission
.
Everyone
)]
void
TakeDamageServerRpc
(
NetworkObjectReference
animalReference
)
{
_currentHealth
--;
slider
.
value
=
_currentHealth
;
if
(
_currentHealth
<=
0
)
{
animalAi
.
ChangeState
(
AnimalAiState
.
Walk
,
null
);
if
(
animalReference
.
TryGet
(
out
NetworkObject
networkObject
))
{
AnimalAi
animalAi
=
networkObject
.
GetComponent
<
AnimalAi
>();
animalAi
.
ChangeState
(
AnimalAiState
.
Walk
,
animalAi
.
transform
);
}
StartCoroutine
(
Die
());
}
}
IEnumerator
Die
()
{
onDead
?.
Invoke
(
true
);
...
...
Assets/_project/Scripts/Systems/Shared/Score.cs
View file @
c831d64b
using
System
;
using
TMPro
;
using
Unity.Netcode
;
using
UnityEngine
;
public
class
Score
:
NetworkBehaviour
{
[
field
:
SerializeField
]
public
NetworkVariable
<
int
>
_score
=
new
NetworkVariable
<
int
>(
readPerm
:
NetworkVariableReadPermission
.
Everyone
,
writePerm
:
NetworkVariableWritePermission
.
Owner
);
[
SerializeField
]
TextMeshProUGUI
scoreText
;
[
field
:
SerializeField
]
public
NetworkVariable
<
int
>
_score
=
new
NetworkVariable
<
int
>(
readPerm
:
NetworkVariableReadPermission
.
Everyone
,
writePerm
:
NetworkVariableWritePermission
.
Server
);
RaycastWeapon
_raycastWeapon
;
private
void
OnEnable
()
...
...
@@ -23,7 +25,8 @@ public class Score : NetworkBehaviour
}
private
void
OnScoreChanged
(
int
previousValue
,
int
newValue
)
{
Debug
.
Log
(
newValue
);
if
(
scoreText
!=
null
)
scoreText
.
text
=
newValue
.
ToString
();
}
private
void
OnDisable
()
...
...
@@ -33,17 +36,21 @@ public class Score : NetworkBehaviour
private
void
AnimalDie
(
int
score
)
{
int
newScore
=
_score
.
Value
+
score
;
if
(!
IsOwner
)
return
;
UpdateScoreServerRpc
(
score
);
}
[
Rpc
(
SendTo
.
Server
,
InvokePermission
=
RpcInvokePermission
.
Owner
)]
private
void
UpdateScoreServerRpc
(
int
scoreToAdd
)
{
int
newScore
=
_score
.
Value
+
scoreToAdd
;
newScore
=
Mathf
.
Max
(
0
,
newScore
);
_score
.
Value
=
newScore
;
AddScoreToLeaderboard
();
}
void
AddScoreToLeaderboard
()
private
void
AddScoreToLeaderboard
()
{
if
(
IsOwner
)
{
// GameManager.Instance.ScoreManager.UpdateScoreServerRpc(NetworkManager.Singleton.LocalClientId, _score);
}
}
}
Assets/_project/Scripts/Systems/Weapon/RaycastWeapon.cs
View file @
c831d64b
...
...
@@ -3,6 +3,7 @@ using System;
using
System.Collections
;
using
TMPro
;
using
Unity.Collections
;
using
Unity.Netcode
;
using
UnityEngine
;
public
class
RaycastWeapon
:
MonoBehaviour
...
...
@@ -50,7 +51,7 @@ public class RaycastWeapon : MonoBehaviour
Reload
();
}
Ray
_ray
;
void
Shoot
(
Vector3
origin
,
Vector3
direction
,
bool
useRay
)
{
_currentAmmo
--;
...
...
ProjectSettings/EditorSettings.asset
View file @
c831d64b
...
...
@@ -25,7 +25,7 @@ EditorSettings:
m_AsyncShaderCompilation
:
1
m_PrefabModeAllowAutoSave
:
1
m_EnterPlayModeOptionsEnabled
:
1
m_EnterPlayModeOptions
:
3
m_EnterPlayModeOptions
:
0
m_GameObjectNamingDigits
:
1
m_GameObjectNamingScheme
:
0
m_AssetNamingUsesSpace
:
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment