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
daeef97a
Commit
daeef97a
authored
Feb 04, 2026
by
Abdulrahman Mohammed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Done with Multiplayer and Gameplay
parent
4495e681
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
934 additions
and
160 deletions
+934
-160
GameSetting.asset
Assets/_project/GameSetting.asset
+1
-1
NPC.prefab
Assets/_project/Prefabs/NPCs/NPC.prefab
+71
-2
Game.unity
Assets/_project/Scenes/Game.unity
+16
-7
LobbyScene.unity
Assets/_project/Scenes/LobbyScene.unity
+521
-1
AppInit.cs
Assets/_project/Scripts/AppInit.cs
+1
-1
AnimalsQuestionGenerator.cs
Assets/_project/Scripts/Core/AnimalsQuestionGenerator.cs
+73
-24
AnimalsSpawner.cs
Assets/_project/Scripts/Core/Manager/AnimalsSpawner.cs
+21
-30
MatchManager.cs
Assets/_project/Scripts/Core/Manager/MatchManager.cs
+9
-3
ScoreManager.cs
Assets/_project/Scripts/Core/Manager/ScoreManager.cs
+9
-16
HandlePlayersConnection.cs
...ect/Scripts/Network/Connection/HandlePlayersConnection.cs
+6
-2
LobbyRoom.cs
Assets/_project/Scripts/Network/Lobby/LobbyRoom.cs
+106
-28
LobbyList.cs
Assets/_project/Scripts/Network/Ui/LobbyList.cs
+3
-1
LobbySlot.cs
Assets/_project/Scripts/Network/Ui/LobbySlot.cs
+13
-13
AuthenticationRequest.cs
...Network/_Requests/Authentication/AuthenticationRequest.cs
+0
-1
LobbyHeart.cs
...ts/_project/Scripts/Network/_Requests/Lobby/LobbyHeart.cs
+1
-0
LobbyRequest.cs
.../_project/Scripts/Network/_Requests/Lobby/LobbyRequest.cs
+22
-2
AnimalAi.cs
Assets/_project/Scripts/Systems/Animal/AnimalAi.cs
+0
-2
NPCsMovement.cs
Assets/_project/Scripts/Systems/NPCs/NPCsMovement.cs
+6
-0
PlayerDetails.cs
Assets/_project/Scripts/Systems/Player/PlayerDetails.cs
+6
-0
HumanHealth.cs
Assets/_project/Scripts/Systems/Shared/HumanHealth.cs
+4
-0
Score.cs
Assets/_project/Scripts/Systems/Shared/Score.cs
+9
-8
LookAtCamera.cs
Assets/_project/Scripts/Systems/UI/LookAtCamera.cs
+4
-3
TypewriterEffect.cs
Assets/_project/Scripts/Systems/UI/TypewriterEffect.cs
+32
-15
No files found.
Assets/_project/GameSetting.asset
View file @
daeef97a
...
...
@@ -13,5 +13,5 @@ MonoBehaviour:
m_Name
:
GameSetting
m_EditorClassIdentifier
:
Assembly-CSharp::GameSetting
<MaxAnimalsInRound>k__BackingField
:
20
<TimeOfRound>k__BackingField
:
30
<TimeOfRound>k__BackingField
:
5
<NumberOfRounds>k__BackingField
:
5
Assets/_project/Prefabs/NPCs/NPC.prefab
View file @
daeef97a
...
...
@@ -70,7 +70,7 @@ RectTransform:
m_AnchorMin
:
{
x
:
0
,
y
:
0
}
m_AnchorMax
:
{
x
:
0
,
y
:
0
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
1.31
}
m_SizeDelta
:
{
x
:
2.5
,
y
:
1.25
}
m_SizeDelta
:
{
x
:
4.27
,
y
:
1.25
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!223
&5506813468715940269
Canvas
:
...
...
@@ -147,6 +147,8 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
e1003c22d83309742a57d43140729116
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Assembly-CSharp::LookAtCamera
ShowTopMostFoldoutHeaderGroup
:
1
_cam
:
{
fileID
:
0
}
---
!u!1
&1501786898965488615
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -747,7 +749,40 @@ MonoBehaviour:
_score
:
m_InternalValue
:
0
isNPC
:
1
_NPCsId
:
0
_NPCsId
:
utf8LengthInBytes
:
0
bytes
:
offset0000
:
byte0000
:
0
byte0001
:
0
byte0002
:
0
byte0003
:
0
byte0004
:
0
byte0005
:
0
byte0006
:
0
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
---
!u!114
&4343223469952472967
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -898,6 +933,40 @@ MonoBehaviour:
byte0027
:
0
byte0028
:
0
byte0029
:
0
playerID
:
utf8LengthInBytes
:
0
bytes
:
offset0000
:
byte0000
:
0
byte0001
:
0
byte0002
:
0
byte0003
:
0
byte0004
:
0
byte0005
:
0
byte0006
:
0
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
:
7462257593087947900
}
avatar
:
---
!u!1001
&97846783079897831
...
...
Assets/_project/Scenes/Game.unity
View file @
daeef97a
...
...
@@ -1812,6 +1812,15 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
eed983e626aa84642aca502efe530d72
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Assembly-CSharp::TagGeneration
_animalProperties
:
-
{
fileID
:
11400000
,
guid
:
ba49ab0ffd1e5f947b131bc56fb61faa
,
type
:
2
}
-
{
fileID
:
11400000
,
guid
:
d0cff163ca026c74b8900eca3bfbe4a9
,
type
:
2
}
-
{
fileID
:
11400000
,
guid
:
4b160f0ac0bdd5b42ad01a593cf2894d
,
type
:
2
}
-
{
fileID
:
11400000
,
guid
:
aede0ffd3c1e09445a39f5b8a5f40568
,
type
:
2
}
-
{
fileID
:
11400000
,
guid
:
489e7b2410467b5478e7479a243f9888
,
type
:
2
}
-
{
fileID
:
11400000
,
guid
:
c5a46d38ee8ca2f46927676a9c31b7b7
,
type
:
2
}
-
{
fileID
:
11400000
,
guid
:
d3547736a5d0c7540bbd29c28348d080
,
type
:
2
}
-
{
fileID
:
11400000
,
guid
:
c5751bd233fcb604aab73e364bf81882
,
type
:
2
}
---
!u!1
&626162506
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -2087,6 +2096,7 @@ MonoBehaviour:
<cursorVisible>k__BackingField
:
{
fileID
:
2129732306
}
<MatchManager>k__BackingField
:
{
fileID
:
1559894302
}
<LeaderboardUI>k__BackingField
:
{
fileID
:
803451462
}
<cam>k__BackingField
:
{
fileID
:
1835655405
}
---
!u!114
&764357413
MonoBehaviour
:
m_ObjectHideFlags
:
0
...
...
@@ -3893,18 +3903,17 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
aae5a095cd37db74f90a8fc0cd6a1bc4
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Assembly-CSharp::AnimalsSpawner
spawnRadius
:
32.1
debugMode
:
0
animalsParent
:
{
fileID
:
1824897285
}
animalsPrefab
:
-
{
fileID
:
7987493137821725887
,
guid
:
28d7b110eacfe554cb177ef86d76bd7c
,
type
:
3
}
-
{
fileID
:
7193057044126680390
,
guid
:
c6e0651bc44ba9f409a5d42ea5643f6f
,
type
:
3
}
-
{
fileID
:
1698350363645929408
,
guid
:
6fef511f71c2f88418c14e5a4afb8f11
,
type
:
3
}
-
{
fileID
:
1677546864663295365
,
guid
:
0078a2e176b908c45aa883f048fc43a4
,
type
:
3
}
-
{
fileID
:
873965636843474627
,
guid
:
68bd54ad24006f94dbb146eb2fe9591e
,
type
:
3
}
-
{
fileID
:
2175243213733850576
,
guid
:
6e1553e4833547f42b69e41a89cd6513
,
type
:
3
}
-
{
fileID
:
7987493137821725887
,
guid
:
28d7b110eacfe554cb177ef86d76bd7c
,
type
:
3
}
-
{
fileID
:
7193057044126680390
,
guid
:
c6e0651bc44ba9f409a5d42ea5643f6f
,
type
:
3
}
-
{
fileID
:
3824715583433605288
,
guid
:
fbf52492f3d40c646b67885c3076a67d
,
type
:
3
}
-
{
fileID
:
8074876253474731934
,
guid
:
65e893d6d8280ff4eba19d6987deed16
,
type
:
3
}
-
{
fileID
:
2175243213733850576
,
guid
:
6e1553e4833547f42b69e41a89cd6513
,
type
:
3
}
spawnRadius
:
32.1
debugMode
:
0
animalsParent
:
{
fileID
:
1824897285
}
_correctAnimal
:
[]
_incorrectAnimal
:
[]
---
!u!1
&1366928035
...
...
Assets/_project/Scenes/LobbyScene.unity
View file @
daeef97a
This diff is collapsed.
Click to expand it.
Assets/_project/Scripts/AppInit.cs
View file @
daeef97a
...
...
@@ -18,7 +18,7 @@ public class AppInit : MonoBehaviour
private
async
void
Join
()
{
FadeWithText
.
Instance
.
ShowMessage
(
"جاري الت
حميل
..."
,
false
);
FadeWithText
.
Instance
.
ShowMessage
(
"جاري الت
هيئة
..."
,
false
);
await
AuthenticationRequest
.
StartAuth
();
FadeWithText
.
Instance
.
FadeOut
();
...
...
Assets/_project/Scripts/Core/AnimalsQuestionGenerator.cs
View file @
daeef97a
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
UnityEngine
;
...
...
@@ -7,21 +8,53 @@ public class AnimalsQuestionGenerator : MonoBehaviour
{
public
List
<
Enum
>
randomTags
{
get
;
private
set
;
}
=
new
List
<
Enum
>();
[
SerializeField
]
StringBuilder
textBuilder
=
new
StringBuilder
();
[
SerializeField
]
AnimalProperties
[]
_animalProperties
;
public
Dictionary
<
string
,
List
<
Enum
>>
AnimalsEnumToList
{
get
;
private
set
;
}
=
new
Dictionary
<
string
,
List
<
Enum
>>();
string
prevQuestion
;
private
void
Awake
()
{
HandleAniamls
();
GengenerateNewQuestions
(
1
);
}
private
void
HandleAniamls
()
{
for
(
int
i
=
0
;
i
<
_animalProperties
.
Length
;
i
++)
{
var
list
=
AddAnimalTagsToList
(
_animalProperties
[
i
]);
if
(!
AnimalsEnumToList
.
ContainsKey
(
_animalProperties
[
i
].
name
))
{
AnimalsEnumToList
.
Add
(
_animalProperties
[
i
].
name
,
list
);
}
}
}
List
<
Enum
>
AddAnimalTagsToList
(
AnimalProperties
animalProperties
)
{
var
animalTag
=
new
List
<
Enum
>
{
animalProperties
.
AnimalType
,
animalProperties
.
FoodType
,
animalProperties
.
Environment
,
animalProperties
.
SpecialAbilities
,
animalProperties
.
Reproduction
};
return
animalTag
;
}
public
void
GengenerateNewQuestions
(
int
numberOfTags
)
{
string
currentQuestionText
=
""
;
do
{
AddRandomTagToList
(
numberOfTags
);
currentQuestionText
=
BuildQuestionString
();
}
while
(!
CheckIfTagsIsCorrect
()
||
currentQuestionText
==
prevQuestion
);
...
...
@@ -31,6 +64,8 @@ public class AnimalsQuestionGenerator : MonoBehaviour
currentQuestionText
=
currentQuestionText
.
Replace
(
"_"
,
" "
);
GameHUD
.
Instance
.
Question
.
Value
=
currentQuestionText
;
}
private
string
BuildQuestionString
()
{
textBuilder
.
Clear
();
...
...
@@ -46,35 +81,49 @@ public class AnimalsQuestionGenerator : MonoBehaviour
{
randomTags
.
Clear
();
if
(
numberOfTag
>=
1
)
{
var
animalTypes
=
(
AnimalType
[])
Enum
.
GetValues
(
typeof
(
AnimalType
));
randomTags
.
Add
(
animalTypes
[
UnityEngine
.
Random
.
Range
(
0
,
animalTypes
.
Length
)]);
}
var
dictionaryValueToList
=
new
List
<
List
<
Enum
>>(
AnimalsEnumToList
.
Values
);
if
(
numberOfTag
>=
2
)
{
var
foodTypes
=
(
FoodType
[])
Enum
.
GetValues
(
typeof
(
FoodType
));
randomTags
.
Add
(
foodTypes
[
UnityEngine
.
Random
.
Range
(
0
,
foodTypes
.
Length
)]);
}
int
randomIndexFromAnimalList
=
UnityEngine
.
Random
.
Range
(
0
,
dictionaryValueToList
.
Count
);
var
selectedList
=
dictionaryValueToList
[
randomIndexFromAnimalList
];
if
(
numberOfTag
>=
3
)
{
var
environments
=
(
Environment
[])
Enum
.
GetValues
(
typeof
(
Environment
));
randomTags
.
Add
(
environments
[
UnityEngine
.
Random
.
Range
(
0
,
environments
.
Length
)]);
}
var
tmpList
=
new
List
<
Enum
>(
selectedList
);
if
(
numberOfTag
>=
4
)
for
(
int
i
=
0
;
i
<
numberOfTag
&&
tmpList
.
Count
>
0
;
i
++
)
{
var
abilities
=
(
SpecialAbilities
[])
Enum
.
GetValues
(
typeof
(
SpecialAbilities
)
);
randomTags
.
Add
(
abilities
[
UnityEngine
.
Random
.
Range
(
0
,
abilities
.
Length
)]
);
randomTags
.
Add
(
tmpList
[
0
]
);
tmpList
.
RemoveAt
(
0
);
}
if
(
numberOfTag
>=
5
)
{
var
reproductions
=
(
Reproduction
[])
Enum
.
GetValues
(
typeof
(
Reproduction
));
randomTags
.
Add
(
reproductions
[
UnityEngine
.
Random
.
Range
(
0
,
reproductions
.
Length
)]);
}
//if (numberOfTag >= 1)
//{
// var animalTypes = (AnimalType[])Enum.GetValues(typeof(AnimalType));
// randomTags.Add(animalTypes[UnityEngine.Random.Range(0, animalTypes.Length)]);
//}
//if (numberOfTag >= 2)
//{
// var foodTypes = (FoodType[])Enum.GetValues(typeof(FoodType));
// randomTags.Add(foodTypes[UnityEngine.Random.Range(0, foodTypes.Length)]);
//}
//if (numberOfTag >= 3)
//{
// var environments = (Environment[])Enum.GetValues(typeof(Environment));
// randomTags.Add(environments[UnityEngine.Random.Range(0, environments.Length)]);
//}
//if (numberOfTag >= 4)
//{
// var abilities = (SpecialAbilities[])Enum.GetValues(typeof(SpecialAbilities));
// randomTags.Add(abilities[UnityEngine.Random.Range(0, abilities.Length)]);
//}
//if (numberOfTag >= 5)
//{
// var reproductions = (Reproduction[])Enum.GetValues(typeof(Reproduction));
// randomTags.Add(reproductions[UnityEngine.Random.Range(0, reproductions.Length)]);
//}
}
bool
CheckIfTagsIsCorrect
()
...
...
Assets/_project/Scripts/Core/Manager/AnimalsSpawner.cs
View file @
daeef97a
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
Unity.Netcode
;
using
UnityEngine
;
using
UnityEngine.AI
;
public
class
AnimalsSpawner
:
MonoBehaviour
{
[
SerializeField
]
GameObject
[]
animalsPrefab
;
[
Header
(
"Spwan Settings"
)]
[
SerializeField
]
float
spawnRadius
;
[
SerializeField
]
bool
debugMode
;
[
Header
(
"Animals Settings"
)]
[
SerializeField
]
Transform
animalsParent
;
[
SerializeField
]
GameObject
[]
animalsPrefab
;
[
SerializeField
]
List
<
GameObject
>
_correctAnimal
=
new
List
<
GameObject
>();
[
SerializeField
]
List
<
GameObject
>
_incorrectAnimal
=
new
List
<
GameObject
>();
...
...
@@ -34,33 +35,29 @@ public class AnimalsSpawner : MonoBehaviour
foreach
(
GameObject
animal
in
animalsPrefab
)
{
var
animalTagToEnumList
=
AddAnimalTagsToList
(
animal
.
GetComponent
<
AnimalDetails
>().
animalProperties
);
foreach
(
Enum
tag
in
randomTags
)
{
if
(
animalTagToEnumList
.
Contains
(
tag
))
_correctAnimal
.
Add
(
animal
);
else
{
_incorrectAnimal
.
Add
(
animal
);
break
;
}
}
GameManager
.
Instance
.
AnimalsQuestionGenerator
.
AnimalsEnumToList
.
TryGetValue
(
animal
.
GetComponent
<
AnimalDetails
>().
animalProperties
.
name
,
out
List
<
Enum
>
enumList
);
bool
correct
=
randomTags
.
All
(
tag
=>
enumList
.
Contains
(
tag
));
if
(
correct
)
_correctAnimal
.
Add
(
animal
);
else
_incorrectAnimal
.
Add
(
animal
);
}
SpawnAnimals
();
}
List
<
Enum
>
AddAnimalTagsToList
(
AnimalProperties
animalProperties
)
{
var
animalTag
=
new
List
<
Enum
>
{
animalProperties
.
AnimalType
,
animalProperties
.
FoodType
,
animalProperties
.
Environment
,
animalProperties
.
SpecialAbilities
,
animalProperties
.
Reproduction
};
//
List<Enum> AddAnimalTagsToList(AnimalProperties animalProperties)
//
{
//
var animalTag = new List<Enum>
//
{
//
animalProperties.AnimalType,
//
animalProperties.FoodType,
//
animalProperties.Environment,
//
animalProperties.SpecialAbilities,
//
animalProperties.Reproduction
//
};
return
animalTag
;
}
//
return animalTag;
//
}
void
SpawnAnimals
()
{
if
(
_correctAnimal
.
Count
>
0
&&
_incorrectAnimal
.
Count
>
0
)
...
...
@@ -95,9 +92,3 @@ public class AnimalsSpawner : MonoBehaviour
}
}
}
//bool correct = randomTags.All(tag => animalTagToEnumList.Contains(tag));
//if (correct)
// _correctAnimal.Add(animal);
//else
// _incorrectAnimal.Add(animal);
\ No newline at end of file
Assets/_project/Scripts/Core/Manager/MatchManager.cs
View file @
daeef97a
...
...
@@ -43,12 +43,19 @@ public class MatchManager : NetworkBehaviour
_currentMatch
++;
_transitionManager
.
onTransitionCutPointReached
+=
ChangeRound
;
ShowFadeMenuClientRpc
(
false
);
StopNPC
(
true
);
}
else
{
_scoreManager
.
ShowWinMenu
();
foreach
(
NPCsMovement
npc
in
NPCsParent
.
GetComponentsInChildren
<
NPCsMovement
>())
{
npc
.
DestroyByServer
();
}
}
DestroyAnimals
();
StopNPC
(
true
);
}
[
Rpc
(
SendTo
.
ClientsAndHost
)]
void
UpdateTimeClientRpc
(
float
_currentTimer
)
...
...
@@ -75,8 +82,7 @@ public class MatchManager : NetworkBehaviour
matchRoundText
.
text
=
_currentMatch
;
_currentTimer
=
GameManager
.
Instance
.
GameSetting
.
TimeOfRound
;
}
void
DestroyAnimals
()
void
DestroyAnimals
()
{
foreach
(
Health
animal
in
animalsParent
.
GetComponentsInChildren
<
Health
>())
{
...
...
Assets/_project/Scripts/Core/Manager/ScoreManager.cs
View file @
daeef97a
...
...
@@ -19,28 +19,21 @@ public class ScoreManager : NetworkBehaviour
}
private
void
RestartGame
()
{
RestartServerRpc
();
}
[
Rpc
(
SendTo
.
Server
,
InvokePermission
=
RpcInvokePermission
.
Everyone
)]
void
RestartServerRpc
()
{
RestartByServer
();
}
void
RestartByServer
()
{
foreach
(
var
client
in
NetworkManager
.
Singleton
.
ConnectedClientsList
)
if
(
IsServer
)
{
client
.
PlayerObject
.
Despawn
(
true
);
foreach
(
var
client
in
NetworkManager
.
Singleton
.
ConnectedClientsList
)
{
client
.
PlayerObject
.
Despawn
(
true
);
}
if
(
NetworkManager
.
Singleton
!=
null
)
NetworkManager
.
Singleton
.
SceneManager
.
LoadScene
(
SceneManager
.
GetActiveScene
().
name
,
LoadSceneMode
.
Single
);
}
if
(
NetworkManager
.
Singleton
!=
null
)
NetworkManager
.
Singleton
.
SceneManager
.
LoadScene
(
SceneManager
.
GetActiveScene
().
name
,
LoadSceneMode
.
Single
);
}
private
void
LeaveRound
()
{
SceneManager
.
LoadScene
(
0
);
NetworkManager
.
Singleton
.
Shutdown
();
ApprovRequest
.
Instance
.
LeavePlayer
();
}
public
void
ShowWinMenu
()
...
...
Assets/_project/Scripts/Network/Connection/HandlePlayersConnection.cs
View file @
daeef97a
...
...
@@ -24,6 +24,9 @@ public class HandlePlayersConnection : NetworkBehaviour
yield
return
new
WaitForSeconds
(
3
);
if
(
IsServer
)
{
if
(
LobbyHeart
.
Instance
!=
null
)
Destroy
(
LobbyHeart
.
Instance
.
gameObject
);
foreach
(
var
_player
in
_approvRequest
.
clientData
)
{
PlayerNetworkData
playerData
=
new
PlayerNetworkData
...
...
@@ -31,7 +34,7 @@ public class HandlePlayersConnection : NetworkBehaviour
PlayerAuthId
=
_player
.
Value
.
AuthId
,
playerName
=
_player
.
Value
.
playerName
,
PlayerAvatar
=
_player
.
Value
.
playerAvatar
,
};
NetworkObject
player
=
Instantiate
(
playerPrefab
);
player
.
SpawnAsPlayerObject
(
_player
.
Key
);
...
...
@@ -47,8 +50,9 @@ public class HandlePlayersConnection : NetworkBehaviour
PlayerAvatar
=
npc
.
Value
.
playerAvatar
,
};
NetworkObject
npcObject
=
Instantiate
(
npcPrefab
,
npcParent
.
transform
);
NetworkObject
npcObject
=
Instantiate
(
npcPrefab
);
npcObject
.
Spawn
();
npcObject
.
transform
.
SetParent
(
npcParent
);
npcObject
.
GetComponent
<
PlayerDetails
>().
InitPlayerData
(
playerData
);
}
}
...
...
Assets/_project/Scripts/Network/Lobby/LobbyRoom.cs
View file @
daeef97a
using
DG.Tweening
;
using
System.Threading.Tasks
;
using
TMPro
;
using
Unity.Netcode
;
using
Unity.Services.Lobbies
;
using
UnityEngine
;
using
UnityEngine.UI
;
using
System.Collections.Generic
;
using
Unity.Services.Lobbies.Models
;
public
class
LobbyRoom
:
NetworkBehaviour
{
...
...
@@ -10,11 +14,14 @@ public class LobbyRoom : NetworkBehaviour
[
SerializeField
]
TextMeshProUGUI
lobbyCode
;
[
SerializeField
]
Button
startButton
;
[
SerializeField
]
Button
exitButton
;
[
SerializeField
]
Button
addNPC
;
[
SerializeField
]
Button
removeNPC
;
[
field
:
SerializeField
]
NetworkList
<
PlayerLobbyData
>
playersData
=
new
NetworkList
<
PlayerLobbyData
>();
int
_currentNPCs
;
int
_currentReady
Player
;
[
SerializeField
]
int
_currentNPCs
;
[
SerializeField
]
int
_current
Player
;
[
SerializeField
]
ApprovRequest
_approvRequest
;
...
...
@@ -22,6 +29,9 @@ public class LobbyRoom : NetworkBehaviour
{
startButton
.
onClick
.
AddListener
(
StartGameClientRpc
);
exitButton
.
onClick
.
AddListener
(
LeaveLobby
);
addNPC
.
onClick
.
AddListener
(
AddNPCs
);
removeNPC
.
onClick
.
AddListener
(
RemoveNPCs
);
}
public
override
void
OnNetworkSpawn
()
...
...
@@ -34,6 +44,9 @@ public class LobbyRoom : NetworkBehaviour
if
(
IsServer
)
{
addNPC
.
gameObject
.
SetActive
(
true
);
removeNPC
.
gameObject
.
SetActive
(
true
);
NetworkManager
.
Singleton
.
OnClientConnectedCallback
+=
OnClientConnected
;
NetworkManager
.
Singleton
.
OnClientDisconnectCallback
+=
OnClientDisConnected
;
...
...
@@ -42,7 +55,13 @@ public class LobbyRoom : NetworkBehaviour
OnClientConnected
(
client
);
}
}
else
{
addNPC
.
gameObject
.
SetActive
(
false
);
removeNPC
.
gameObject
.
SetActive
(
false
);
}
}
public
override
void
OnNetworkDespawn
()
{
playersData
.
OnListChanged
-=
UpdateList
;
...
...
@@ -74,6 +93,73 @@ public class LobbyRoom : NetworkBehaviour
}
}
}
async
void
AddNPCs
()
{
FadeWithText
.
Instance
.
ShowMessage
(
"جاري اضافة لاعب الي..."
,
false
);
_currentNPCs
++;
addNPC
.
interactable
=
false
;
UpdateLobbyOptions
updateLobby
=
new
UpdateLobbyOptions
();
updateLobby
.
Data
=
new
Dictionary
<
string
,
DataObject
>
{
{
"NPCsCount"
,
new
DataObject
(
DataObject
.
VisibilityOptions
.
Public
,
value
:
_currentNPCs
.
ToString
())
}
};
bool
isUpdated
=
await
LobbyRequest
.
UpdateLobby
(
updateLobby
);
if
(
isUpdated
)
{
ulong
NPCsId
=
(
ulong
)
Random
.
Range
(
1000
,
9999
);
playersData
.
Add
(
new
PlayerLobbyData
{
clientId
=
NPCsId
,
playerName
=
"NPC#"
+
NPCsId
,
playerAvatar
=
4
,
isReady
=
true
,
isNPC
=
true
,
});
FadeWithText
.
Instance
.
FadeOut
();
}
else
{
_currentNPCs
--;
FadeWithText
.
Instance
.
ShowMessage
(
"حدث خطأ في اضافة لاعب الي"
,
true
);
}
}
private
async
void
RemoveNPCs
()
{
FadeWithText
.
Instance
.
ShowMessage
(
"جاري اضافة لاعب الي..."
,
false
);
_currentNPCs
--;
addNPC
.
interactable
=
false
;
UpdateLobbyOptions
updateLobby
=
new
UpdateLobbyOptions
();
updateLobby
.
Data
=
new
Dictionary
<
string
,
DataObject
>
{
{
"NPCsCount"
,
new
DataObject
(
DataObject
.
VisibilityOptions
.
Public
,
value
:
_currentNPCs
.
ToString
())
}
};
bool
isUpdated
=
await
LobbyRequest
.
UpdateLobby
(
updateLobby
);
if
(
isUpdated
)
{
for
(
int
i
=
0
;
i
<
playersData
.
Count
;
i
++)
{
if
(
playersData
[
i
].
isNPC
)
{
OnClientDisConnected
(
playersData
[
i
].
clientId
);
break
;
}
}
FadeWithText
.
Instance
.
FadeOut
();
}
else
{
_currentNPCs
++;
FadeWithText
.
Instance
.
ShowMessage
(
"حدث خطأ في حذف اللاعب الالي"
,
true
);
}
}
private
void
UpdateList
(
NetworkListEvent
<
PlayerLobbyData
>
newList
)
{
for
(
int
i
=
0
;
i
<
playersSlot
.
Length
;
i
++)
...
...
@@ -93,9 +179,15 @@ public class LobbyRoom : NetworkBehaviour
startButton
.
interactable
=
CheckIfAllPlayerIsReady
();
bool
CheckIfAllReady
=
CheckIfAllPlayerIsReady
();
ChangeButtonClientRpc
(
CheckIfAllReady
);
UpdateNPCButtons
();
}
}
void
UpdateNPCButtons
()
{
_currentPlayer
=
NetworkManager
.
Singleton
.
ConnectedClientsIds
.
Count
;
addNPC
.
interactable
=
_currentNPCs
+
_currentPlayer
<
4
;
removeNPC
.
interactable
=
_currentNPCs
>
0
;
}
[
Rpc
(
SendTo
.
ClientsAndHost
)]
void
ChangeButtonClientRpc
(
bool
CheckIfAllReady
)
{
...
...
@@ -104,10 +196,9 @@ public class LobbyRoom : NetworkBehaviour
private
bool
CheckIfAllPlayerIsReady
()
{
if
(
playersData
.
Count
<
2
)
return
false
;
if
(
playersData
.
Count
<
4
)
return
false
;
foreach
(
var
player
in
playersData
)
{
if
(!
player
.
isReady
)
return
false
;
}
return
true
;
...
...
@@ -120,30 +211,18 @@ public class LobbyRoom : NetworkBehaviour
public
void
IsButtonClicked
(
ulong
clientId
,
bool
isBusy
)
{
if
(!
isBusy
)
{
AddNpc
();
}
else
SetPlayerReadyServerRpc
(
clientId
);
}
SetPlayerReadyServerRpc
(
clientId
);
void
AddNpc
()
{
ulong
NPCsId
=
(
ulong
)
Random
.
Range
(
1000
,
9999
);
playersData
.
Add
(
new
PlayerLobbyData
{
clientId
=
NPCsId
,
playerName
=
"NPC#"
+
NPCsId
,
playerAvatar
=
4
,
isReady
=
true
,
isNPC
=
true
,
});
}
public
void
RemoveRpc
(
ulong
slotId
)
{
OnClientDisConnected
(
slotId
);
//if (!isBusy)
//{
// AddNpc();
//}
//else
// SetPlayerReadyServerRpc(clientId);
}
[
Rpc
(
SendTo
.
Server
,
InvokePermission
=
RpcInvokePermission
.
Everyone
)]
void
SetPlayerReadyServerRpc
(
ulong
clientId
)
{
...
...
@@ -167,7 +246,6 @@ public class LobbyRoom : NetworkBehaviour
private
void
StartGameClientRpc
()
{
FadeWithText
.
Instance
.
ShowMessage
(
"جاري الدخول..."
,
false
);
if
(
IsServer
)
{
for
(
int
i
=
0
;
i
<
playersData
.
Count
;
i
++)
...
...
Assets/_project/Scripts/Network/Ui/LobbyList.cs
View file @
daeef97a
...
...
@@ -17,7 +17,7 @@ public class LobbyList : MonoBehaviour
private
async
void
RefreshLobbyList
()
{
refreshButton
.
interactable
=
false
;
FadeWithText
.
Instance
.
ShowMessage
(
"جاري ال
تحميل
"
,
false
);
FadeWithText
.
Instance
.
ShowMessage
(
"جاري ال
بحث عن مبارايات...
"
,
false
);
QueryResponse
list
=
await
LobbyRequest
.
CurrentLobbies
();
DestroyLastLobbysList
();
...
...
@@ -30,6 +30,8 @@ public class LobbyList : MonoBehaviour
string
playersCount
=
$"
{
npcCounter
}
/
{
lobby
.
MaxPlayers
}
"
;
lobbyDetails
.
AddDetailsToLobby
(
lobby
.
Name
,
playersCount
,
lobby
.
Id
,
lobby
.
Data
[
"RelayCode"
].
Value
);
lobbyDetails
.
gameObject
.
SetActive
(
npcCounter
<
lobby
.
MaxPlayers
);
}
StartCoroutine
(
FadeOutAfterDelay
());
}
...
...
Assets/_project/Scripts/Network/Ui/LobbySlot.cs
View file @
daeef97a
...
...
@@ -21,23 +21,24 @@ public class LobbySlot : MonoBehaviour
private
void
Start
()
{
readyButton
.
onClick
.
AddListener
(
Ready
);
removeButton
.
onClick
.
AddListener
(
RemoveNpc
);
// removeButton.onClick.AddListener(RemoveNpcs
);
_lobbyRoom
=
FindAnyObjectByType
<
LobbyRoom
>();
removeButton
.
gameObject
.
SetActive
(
false
);
}
public
void
AddData
(
PlayerLobbyData
playerLobbyData
)
{
_isBusy
=
true
;
bool
localClient
=
NetworkManager
.
Singleton
.
LocalClientId
==
playerLobbyData
.
clientId
;
bool
npc
=
playerLobbyData
.
isNPC
&&
NetworkManager
.
Singleton
.
IsServer
;
//
bool npc = playerLobbyData.isNPC && NetworkManager.Singleton.IsServer;
removeButton
.
gameObject
.
SetActive
(
npc
);
_slotId
=
playerLobbyData
.
clientId
;
_isNPC
=
playerLobbyData
.
isNPC
;
readyButton
.
interactable
=
localClient
||
npc
&&
!
_isBusy
;
removeButton
.
interactable
=
localClient
||
npc
;
readyButton
.
interactable
=
localClient
;
//
|| npc && !_isBusy;
//
removeButton.interactable = localClient || npc;
ChangeAvatar
(
playerLobbyData
.
playerAvatar
);
playerName
.
text
=
playerLobbyData
.
playerName
.
ToString
();
...
...
@@ -71,24 +72,23 @@ public class LobbySlot : MonoBehaviour
_lobbyRoom
.
IsButtonClicked
(
_slotId
,
_isBusy
);
}
private
void
RemoveNpc
()
{
_lobbyRoom
.
RemoveRpc
(
_slotId
);
//
private void RemoveNpc()
//
{
//
_lobbyRoom.RemoveRpc(_slotId);
}
//
}
public
void
ClearData
()
{
ChangeAvatar
(
0
);
readyButton
.
GetComponent
<
Image
>().
color
=
Color
.
white
;
readyButton
.
GetComponentInChildren
<
TextMeshProUGUI
>().
text
=
"
Add NPC
"
;
readyButton
.
GetComponentInChildren
<
TextMeshProUGUI
>().
text
=
"
No Player
"
;
playerName
.
text
=
" "
;
_isNPC
=
false
;
_isBusy
=
false
;
// removeButton.gameObject.SetActive(false);
_slotId
=
(
ulong
)
0000
;
readyButton
.
interactable
=
NetworkManager
.
Singleton
.
IsServer
;
removeButton
.
gameObject
.
SetActive
(
false
);
//
readyButton.interactable = NetworkManager.Singleton.IsServer;
//
removeButton.gameObject.SetActive(false);
}
}
Assets/_project/Scripts/Network/_Requests/Authentication/AuthenticationRequest.cs
View file @
daeef97a
...
...
@@ -2,7 +2,6 @@
using
System.Threading.Tasks
;
using
Unity.Services.Authentication
;
using
Unity.Services.Core
;
using
Unity.VisualScripting
;
using
UnityEngine
;
public
enum
AuthState
...
...
Assets/_project/Scripts/Network/_Requests/Lobby/LobbyHeart.cs
View file @
daeef97a
...
...
@@ -21,5 +21,6 @@ public class LobbyHeart : MonoBehaviour
private
void
OnDestroy
()
{
StopCoroutine
(
_heartCoroutine
);
_
=
LobbyRequest
.
RemoveLobby
();
}
}
Assets/_project/Scripts/Network/_Requests/Lobby/LobbyRequest.cs
View file @
daeef97a
...
...
@@ -80,7 +80,6 @@ public static class LobbyRequest
public
static
async
Task
RemovePlayerFromLobby
(
string
playerId
)
{
if
(
_currentLobby
==
null
)
return
;
Debug
.
Log
(
"Remmove"
);
try
{
if
(
playerId
==
AuthenticationService
.
Instance
.
PlayerId
)
...
...
@@ -135,7 +134,28 @@ public static class LobbyRequest
}
return
string
.
Empty
;
}
public
static
async
Task
<
bool
>
UpdateLobby
(
UpdateLobbyOptions
options
)
{
try
{
await
LobbyService
.
Instance
.
UpdateLobbyAsync
(
_currentLobby
.
Id
,
options
);
return
true
;
}
catch
(
LobbyServiceException
ex
)
{
if
(
ex
.
Reason
==
LobbyExceptionReason
.
RateLimited
)
{
Debug
.
LogException
(
ex
);
Debug
.
Log
(
"Rate Limit"
);
}
return
false
;
}
catch
(
Exception
ex
)
{
Debug
.
LogException
(
ex
);
return
false
;
}
}
}
Assets/_project/Scripts/Systems/Animal/AnimalAi.cs
View file @
daeef97a
...
...
@@ -262,7 +262,6 @@ public class AnimalAi : NetworkBehaviour
{
return
NavMesh
.
SamplePosition
(
pos
,
out
NavMeshHit
hit
,
2
,
NavMesh
.
AllAreas
);
}
public
void
HitHunter
()
// call from animation attack event
{
HitHunterServerRpc
();
...
...
@@ -271,7 +270,6 @@ public class AnimalAi : NetworkBehaviour
[
Rpc
(
SendTo
.
Server
,
InvokePermission
=
RpcInvokePermission
.
Everyone
)]
void
HitHunterServerRpc
()
{
HitHunterClientRpc
();
}
[
Rpc
(
SendTo
.
ClientsAndHost
)]
...
...
Assets/_project/Scripts/Systems/NPCs/NPCsMovement.cs
View file @
daeef97a
using
System
;
using
Unity.Netcode
;
using
UnityEngine
;
using
UnityEngine.AI
;
...
...
@@ -79,4 +80,9 @@ public class NPCsMovement : MonoBehaviour
if
(
_agent
!=
null
)
_agent
.
isStopped
=
status
;
}
public
void
DestroyByServer
()
{
if
(
NetworkManager
.
Singleton
.
IsServer
)
GetComponent
<
NetworkObject
>().
Despawn
(
true
);
}
}
Assets/_project/Scripts/Systems/Player/PlayerDetails.cs
View file @
daeef97a
...
...
@@ -9,6 +9,7 @@ public class PlayerDetails : NetworkBehaviour
public
NetworkVariable
<
PlayerNetworkData
>
playerNetworkData
=
new
NetworkVariable
<
PlayerNetworkData
>(
default
,
NetworkVariableReadPermission
.
Everyone
,
NetworkVariableWritePermission
.
Server
);
public
NetworkVariable
<
FixedString32Bytes
>
PlayerName
=
new
NetworkVariable
<
FixedString32Bytes
>(
"Null"
,
readPerm
:
NetworkVariableReadPermission
.
Everyone
,
writePerm
:
NetworkVariableWritePermission
.
Owner
);
[
SerializeField
]
FixedString32Bytes
playerID
;
[
SerializeField
]
RTLTextMeshPro
nameText
;
[
SerializeField
]
string
avatar
;
...
...
@@ -17,8 +18,13 @@ public class PlayerDetails : NetworkBehaviour
if
(
IsServer
)
{
this
.
playerNetworkData
.
Value
=
playerNetworkData
;
playerID
=
playerNetworkData
.
PlayerAuthId
;
}
}
public
FixedString32Bytes
GetPlayerId
()
{
return
this
.
playerID
;
}
public
override
void
OnNetworkSpawn
()
{
playerNetworkData
.
OnValueChanged
+=
UpdatedData
;
...
...
Assets/_project/Scripts/Systems/Shared/HumanHealth.cs
View file @
daeef97a
...
...
@@ -20,6 +20,10 @@ public class HumanHealth : NetworkBehaviour
_currentHealth
=
maxHealth
;
slider
.
maxValue
=
maxHealth
;
}
public
override
void
OnNetworkSpawn
()
{
if
(!
IsOwner
)
slider
.
gameObject
.
SetActive
(
false
);
}
public
void
TakeDamage
(
AnimalAi
animalAi
)
{
TakeDamageServerRpc
(
animalAi
.
GetComponent
<
NetworkObject
>());
...
...
Assets/_project/Scripts/Systems/Shared/Score.cs
View file @
daeef97a
using
RTLTMPro
;
using
System.Collections
;
using
Unity.Collections
;
using
Unity.Netcode
;
using
UnityEngine
;
public
class
Score
:
NetworkBehaviour
...
...
@@ -7,7 +8,7 @@ public class Score : NetworkBehaviour
[
field
:
SerializeField
]
public
NetworkVariable
<
int
>
_score
=
new
NetworkVariable
<
int
>(
readPerm
:
NetworkVariableReadPermission
.
Everyone
,
writePerm
:
NetworkVariableWritePermission
.
Server
);
[
SerializeField
]
bool
isNPC
;
RaycastWeapon
_raycastWeapon
;
[
SerializeField
]
ulong
_NPCsId
;
[
SerializeField
]
FixedString32Bytes
_NPCsId
;
string
_playerName
;
private
void
OnEnable
()
{
...
...
@@ -35,23 +36,23 @@ public class Score : NetworkBehaviour
newScore
=
Mathf
.
Max
(
0
,
newScore
);
_score
.
Value
=
newScore
;
if
(
isNPC
)
GameManager
.
Instance
.
LeaderboardUI
.
AddPlayerToLeaderboard
(
"NPC#"
+
_NPCsId
,
_score
.
Value
,
_NPCsId
);
GameManager
.
Instance
.
LeaderboardUI
.
AddPlayerToLeaderboard
(
"NPC#"
+
_NPCsId
,
_score
.
Value
,
ulong
.
Parse
(
_NPCsId
.
ToString
())
);
else
GameManager
.
Instance
.
LeaderboardUI
.
AddPlayerToLeaderboard
(
_playerName
,
_score
.
Value
,
OwnerClientId
);
}
IEnumerator
InitScore
()
{
yield
return
new
WaitForSeconds
(
1
);
if
(
isNPC
)
if
(
isNPC
&&
IsServer
)
{
_NPCsId
=
(
ulong
)
Random
.
Range
(
1000
,
9999
);
GameManager
.
Instance
.
LeaderboardUI
.
AddPlayerToLeaderboard
(
"NPC#"
+
_NPCsId
,
0
,
_NPCsId
);
_NPCsId
=
GetComponent
<
PlayerDetails
>().
GetPlayerId
();
GameManager
.
Instance
.
LeaderboardUI
.
AddPlayerToLeaderboard
(
"NPC#"
+
_NPCsId
,
0
,
ulong
.
Parse
(
_NPCsId
.
ToString
()));
GetComponentInChildren
<
RTLTextMeshPro
>().
text
=
$"NPC#
{
_NPCsId
}
"
;
}
if
(
TryGetComponent
<
PlayerDetails
>(
out
PlayerDetails
playerDetails
))
else
{
_playerName
=
playerDetails
.
playerNetworkData
.
Value
.
playerName
.
ToString
();
_playerName
=
GetComponent
<
PlayerDetails
>().
playerNetworkData
.
Value
.
playerName
.
ToString
();
GameManager
.
Instance
.
LeaderboardUI
.
AddPlayerToLeaderboard
(
_playerName
,
0
,
OwnerClientId
);
}
...
...
Assets/_project/Scripts/Systems/UI/LookAtCamera.cs
View file @
daeef97a
using
Unity.Netcode
;
using
UnityEngine
;
public
class
LookAtCamera
:
Mono
Behaviour
public
class
LookAtCamera
:
Network
Behaviour
{
Camera
_cam
;
[
SerializeField
]
Camera
_cam
;
void
Start
()
public
override
void
OnNetworkSpawn
()
{
_cam
=
Camera
.
main
;
}
...
...
Assets/_project/Scripts/Systems/UI/TypewriterEffect.cs
View file @
daeef97a
...
...
@@ -2,36 +2,53 @@
using
UnityEngine
;
using
DG.Tweening
;
using
RTLTMPro
;
class
AnimalPropertiesProgress
{
public
int
maxVisibleCharacters
;
public
bool
isDone
;
}
public
class
TypewriterEffect
:
MonoBehaviour
{
[
SerializeField
]
float
typeDuration
;
[
SerializeField
]
List
<
AnimalProperties
>
animalDetailsList
=
new
List
<
AnimalPropertie
s
>();
Dictionary
<
AnimalProperties
,
AnimalPropertiesProgress
>
animalPropertiesList
=
new
Dictionary
<
AnimalProperties
,
AnimalPropertiesProgres
s
>();
RTLTextMeshPro
_textMeshProUGUI
;
AnimalDetails
_currentAnimal
;
AnimalDetails
_currentAnimal
Script
;
Tween
currentTween
;
void
Start
()
{
_textMeshProUGUI
=
GetComponent
<
RTLTextMeshPro
>();
}
public
void
ShowAnimalDetails
(
AnimalDetails
animalDetails
)
}
public
void
ShowAnimalDetails
(
AnimalDetails
animalDetailsScript
)
{
if
(
_currentAnimal
==
animalDetails
)
return
;
_currentAnimal
=
animalDetails
;
if
(
_currentAnimalScript
==
animalDetailsScript
)
return
;
_currentAnimalScript
=
animalDetailsScript
;
_textMeshProUGUI
.
maxVisibleCharacters
=
0
;
if
(!
animal
DetailsList
.
Contains
(
animalDetails
.
animalProperties
))
if
(!
animal
PropertiesList
.
ContainsKey
(
animalDetailsScript
.
animalProperties
))
{
animalDetailsList
.
Add
(
animalDetails
.
animalProperties
);
WriteText
(
animalDetails
);
_textMeshProUGUI
.
maxVisibleCharacters
=
0
;
currentTween
=
DOTween
.
To
(()
=>
_textMeshProUGUI
.
maxVisibleCharacters
,
x
=>
_textMeshProUGUI
.
maxVisibleCharacters
=
x
,
_textMeshProUGUI
.
text
.
Length
,
typeDuration
)
.
SetEase
(
Ease
.
Linear
);
animalPropertiesList
.
Add
(
animalDetailsScript
.
animalProperties
,
new
AnimalPropertiesProgress
());
}
else
var
value
=
animalPropertiesList
[
animalDetailsScript
.
animalProperties
];
WriteText
(
animalDetailsScript
);
if
(
value
.
isDone
)
{
WriteText
(
animalDetails
);
_textMeshProUGUI
.
maxVisibleCharacters
=
_textMeshProUGUI
.
text
.
Length
;
return
;
}
currentTween
?.
Kill
();
currentTween
=
DOVirtual
.
Int
(
value
.
maxVisibleCharacters
,
_textMeshProUGUI
.
text
.
Length
,
typeDuration
,
(
newValue
)
=>
{
value
.
maxVisibleCharacters
=
newValue
;
_textMeshProUGUI
.
maxVisibleCharacters
=
newValue
;
}).
SetEase
(
Ease
.
Linear
).
OnComplete
(()
=>
{
value
.
isDone
=
true
;
});
}
void
WriteText
(
AnimalDetails
animalDetails
)
{
...
...
@@ -42,7 +59,7 @@ public class TypewriterEffect : MonoBehaviour
}
public
void
HideText
()
{
_currentAnimal
=
null
;
_currentAnimal
Script
=
null
;
_textMeshProUGUI
.
text
=
" "
;
if
(
currentTween
!=
null
&&
currentTween
.
IsActive
())
...
...
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