Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
IF3210-2023-Unity-KDA
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jason Kanggara
IF3210-2023-Unity-KDA
Commits
88e815d4
Commit
88e815d4
authored
Apr 15, 2023
by
Saul Sayers
Browse files
Options
Downloads
Plain Diff
Merge branch 'main' of
https://gitlab.informatika.org/jasonk19/if3210-2023-unity-kda
parents
b2d526ba
74213939
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Assets/Scripts/Managers/CheatManager.cs
+14
-9
14 additions, 9 deletions
Assets/Scripts/Managers/CheatManager.cs
Assets/Scripts/Pets/PetHealth.cs
+12
-8
12 additions, 8 deletions
Assets/Scripts/Pets/PetHealth.cs
with
26 additions
and
17 deletions
Assets/Scripts/Managers/CheatManager.cs
+
14
−
9
View file @
88e815d4
...
@@ -8,6 +8,8 @@ public class CheatManager : MonoBehaviour
...
@@ -8,6 +8,8 @@ public class CheatManager : MonoBehaviour
string
[]
cheatCodes
;
string
[]
cheatCodes
;
bool
isMotherlodeCheat
=
false
;
bool
isMotherlodeCheat
=
false
;
PetHealth
petHealthScript
;
// Start is called before the first frame update
// Start is called before the first frame update
void
Start
()
void
Start
()
{
{
...
@@ -31,41 +33,44 @@ public class CheatManager : MonoBehaviour
...
@@ -31,41 +33,44 @@ public class CheatManager : MonoBehaviour
if
(
Input
.
GetKeyDown
(
KeyCode
.
C
))
{
if
(
Input
.
GetKeyDown
(
KeyCode
.
C
))
{
Debug
.
Log
(
"Show Cheat Codes"
);
NotificationManager
.
ShowNotification
(
cheatCodes
[
Random
.
Range
(
0
,
cheatCodes
.
Length
)],
2.0f
);
NotificationManager
.
ShowNotification
(
cheatCodes
[
Random
.
Range
(
0
,
cheatCodes
.
Length
)],
2.0f
);
}
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
RightAlt
))
{
}
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
RightAlt
))
{
Debug
.
Log
(
"No Damage Cheat"
);
PlayerHealth
.
noDamageCheat
=
true
;
PlayerHealth
.
noDamageCheat
=
true
;
NotificationManager
.
ShowNotification
(
"No Damage Cheat is ON"
,
2.0f
);
NotificationManager
.
ShowNotification
(
"No Damage Cheat is ON"
,
2.0f
);
}
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
LeftAlt
))
{
}
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
LeftAlt
))
{
Debug
.
Log
(
"1 Hit Kill Cheat"
);
PlayerShooting
.
hitKillCheat
=
true
;
PlayerShooting
.
hitKillCheat
=
true
;
NotificationManager
.
ShowNotification
(
"1 Hit Kill Cheat is ON"
,
2.0f
);
NotificationManager
.
ShowNotification
(
"1 Hit Kill Cheat is ON"
,
2.0f
);
}
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
Z
))
{
}
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
Z
))
{
Debug
.
Log
(
"Motherlode Cheat"
);
isMotherlodeCheat
=
true
;
isMotherlodeCheat
=
true
;
GoldManager
.
gold
=
99999
;
GoldManager
.
gold
=
99999
;
NotificationManager
.
ShowNotification
(
"Motherlode Cheat"
,
2.0f
);
NotificationManager
.
ShowNotification
(
"Motherlode Cheat"
,
2.0f
);
}
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
Equals
))
{
}
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
Equals
))
{
Debug
.
Log
(
"x2 Speed Cheat"
);
PlayerMovement
.
speed
=
12f
;
PlayerMovement
.
speed
=
12f
;
NotificationManager
.
ShowNotification
(
"x2 Speed Cheat is ON"
,
2.0f
);
NotificationManager
.
ShowNotification
(
"x2 Speed Cheat is ON"
,
2.0f
);
}
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
Backslash
))
{
}
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
Backslash
))
{
Debug
.
Log
(
"Full HP Pet Cheat"
);
PetHealth
.
isFullHPCheat
=
true
;
NotificationManager
.
ShowNotification
(
"Full HP Pet Cheat is ON"
,
2.0f
);
}
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
P
))
{
}
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
P
))
{
GameObject
pet
=
GameObject
.
FindGameObjectWithTag
(
"Pet"
);
Debug
.
Log
(
"Kill Pet Cheat"
);
if
(
pet
is
not
null
)
{
petHealthScript
=
pet
.
GetComponent
<
PetHealth
>();
petHealthScript
.
Death
();
NotificationManager
.
ShowNotification
(
"Kill Pet Cheat is ON, Pet is Dead"
,
2.0f
);
}
else
{
NotificationManager
.
ShowNotification
(
"Kill Pet Cheat is ON, but you don't have a pet"
,
2.0f
);
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Assets/Scripts/Pets/PetHealth.cs
+
12
−
8
View file @
88e815d4
...
@@ -8,6 +8,8 @@ public class PetHealth : MonoBehaviour
...
@@ -8,6 +8,8 @@ public class PetHealth : MonoBehaviour
public
int
currentHealth
;
public
int
currentHealth
;
public
AudioClip
deathClip
;
public
AudioClip
deathClip
;
public
static
bool
isFullHPCheat
=
false
;
Animator
anim
;
Animator
anim
;
AudioSource
petAudio
;
AudioSource
petAudio
;
...
@@ -38,6 +40,7 @@ public class PetHealth : MonoBehaviour
...
@@ -38,6 +40,7 @@ public class PetHealth : MonoBehaviour
if
(
isDead
)
if
(
isDead
)
return
;
return
;
if
(!
isFullHPCheat
)
{
petAudio
.
Play
();
petAudio
.
Play
();
currentHealth
-=
amount
;
currentHealth
-=
amount
;
...
@@ -50,9 +53,10 @@ public class PetHealth : MonoBehaviour
...
@@ -50,9 +53,10 @@ public class PetHealth : MonoBehaviour
Death
();
Death
();
}
}
}
}
}
void
Death
()
public
void
Death
()
{
{
isDead
=
true
;
isDead
=
true
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment