Skip to content
Snippets Groups Projects
Commit ce7b0468 authored by Salomo309's avatar Salomo309
Browse files

refactor: cheat, activate and deactivate done

parent 37158200
Branches
Tags
No related merge requests found
...@@ -14,6 +14,12 @@ public class DebugController : MonoBehaviour ...@@ -14,6 +14,12 @@ public class DebugController : MonoBehaviour
public static DebugCommand ONE_HIT_KILL; public static DebugCommand ONE_HIT_KILL;
public static DebugCommand MOTHERLODE; public static DebugCommand MOTHERLODE;
public static DebugCommand DOUBLE_SPEED; public static DebugCommand DOUBLE_SPEED;
public static DebugCommand DEACTIVATE_NO_DAMAGE;
public static DebugCommand DEACTIVATE_ONE_HIT_KILL;
public static DebugCommand DEACTIVATE_MOTHERLODE;
public static DebugCommand DEACTIVATE_DOUBLE_SPEED;
public static DebugCommand PET_FULL_HP; public static DebugCommand PET_FULL_HP;
public static DebugCommand KILL_PET; public static DebugCommand KILL_PET;
public static DebugCommand ORB; public static DebugCommand ORB;
...@@ -56,7 +62,7 @@ public class DebugController : MonoBehaviour ...@@ -56,7 +62,7 @@ public class DebugController : MonoBehaviour
ONE_HIT_KILL = new DebugCommand("one_hit_kill", "Player Can Kill Enemy with One Hit.", "one_hit_kill", () => ONE_HIT_KILL = new DebugCommand("one_hit_kill", "Player Can Kill Enemy with One Hit.", "one_hit_kill", () =>
{ {
FindObjectOfType<PlayerShooting>().CheatOneHitKill(); FindObjectOfType<PlayerAttribute>().CheatOneHitKill();
}); });
MOTHERLODE = new DebugCommand("motherlode", "Gain Resources.", "motherlode", () => MOTHERLODE = new DebugCommand("motherlode", "Gain Resources.", "motherlode", () =>
...@@ -69,6 +75,26 @@ public class DebugController : MonoBehaviour ...@@ -69,6 +75,26 @@ public class DebugController : MonoBehaviour
FindObjectOfType<PlayerMovement>().CheatDoubleSpeed(); FindObjectOfType<PlayerMovement>().CheatDoubleSpeed();
}); });
DEACTIVATE_NO_DAMAGE = new DebugCommand("deactivate_no_damage", "Player Has No Damage.", "deactivate_no_damage", () =>
{
FindObjectOfType<PlayerHealth>().DeactivateCheatNoDamage();
});
DEACTIVATE_ONE_HIT_KILL = new DebugCommand("deactivate_one_hit_kill", "Player Can Kill Enemy with One Hit.", "deactivate_one_hit_kill", () =>
{
FindObjectOfType<PlayerAttribute>().DeactivateCheatOneHitKill();
});
DEACTIVATE_MOTHERLODE = new DebugCommand("deactivate_motherlode", "Gain Resources.", "deactivate_motherlode", () =>
{
FindObjectOfType<PlayerGold>().DeactivateCheatMotherlode();
});
DEACTIVATE_DOUBLE_SPEED = new DebugCommand("deactivate_double_speed", "Double Player Speed.", "deactivate_double_speed", () =>
{
FindObjectOfType<PlayerMovement>().DeactivateCheatDoubleSpeed();
});
PET_FULL_HP = new DebugCommand("pet_full_hp", "Restore Pet's Health to Full.", "pet_full_hp", () => PET_FULL_HP = new DebugCommand("pet_full_hp", "Restore Pet's Health to Full.", "pet_full_hp", () =>
{ {
FindObjectOfType<PetHeatlh>().CheatPetFullHP(); FindObjectOfType<PetHeatlh>().CheatPetFullHP();
...@@ -76,12 +102,12 @@ public class DebugController : MonoBehaviour ...@@ -76,12 +102,12 @@ public class DebugController : MonoBehaviour
KILL_PET = new DebugCommand("kill_pet", "Kill Pet.", "kill_pet", () => KILL_PET = new DebugCommand("kill_pet", "Kill Pet.", "kill_pet", () =>
{ {
FindObjectOfType<PlayerShooting>().CheatKillPet(); FindObjectOfType<PlayerAttribute>().CheatKillPet();
}); });
ORB = new DebugCommand("orb", "Spawn Orb.", "orb", () => ORB = new DebugCommand("orb", "Spawn Orb.", "orb", () =>
{ {
FindObjectOfType<PlayerShooting>().CheatOrb(); FindObjectOfType<PlayerHealth>().CheatOrb();
}); });
SKIP_LEVEL = new DebugCommand("skip_level", "Skip Current Level.", "skip_level", () => SKIP_LEVEL = new DebugCommand("skip_level", "Skip Current Level.", "skip_level", () =>
......
using Nightmare;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerAttribute : MonoBehaviour
{
public bool isOneHitKill = false;
void Awake()
{
}
void Update()
{
}
public void CheatOneHitKill()
{
isOneHitKill = true;
FindObjectOfType<GunAttack>().damagePerShot = 9999;
FindObjectOfType<ShotgunAttack>().damagePerBullet = 9999;
FindObjectOfType<SwordAttack>().damagePerSlash = 9999;
}
public void DeactivateCheatOneHitKill()
{
isOneHitKill = false;
FindObjectOfType<GunAttack>().damagePerShot = 20;
FindObjectOfType<ShotgunAttack>().damagePerBullet = 5;
FindObjectOfType<SwordAttack>().damagePerSlash = 40;
}
public void CheatKillPet()
{
// Bunuh pet
// Misalnya:
// petHealth.TakeDamage(petHealth.CurrentHealth());
}
}
fileFormatVersion: 2
guid: a3e213799f809834ea32edb63b9f8361
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -14,6 +14,14 @@ namespace Nightmare ...@@ -14,6 +14,14 @@ namespace Nightmare
currentGold = startingGold; currentGold = startingGold;
} }
private void Update()
{
if (isMotherlode)
{
currentGold = int.MaxValue;
}
}
public void AddGold(int amount) public void AddGold(int amount)
{ {
currentGold += amount; currentGold += amount;
...@@ -34,6 +42,12 @@ namespace Nightmare ...@@ -34,6 +42,12 @@ namespace Nightmare
isMotherlode = true; isMotherlode = true;
currentGold = int.MaxValue; currentGold = int.MaxValue;
} }
public void DeactivateCheatMotherlode()
{
isMotherlode = false;
currentGold = 100;
}
} }
} }
...@@ -125,5 +125,15 @@ namespace Nightmare ...@@ -125,5 +125,15 @@ namespace Nightmare
{ {
godMode = false; godMode = false;
} }
public void CheatOrb()
{
currentHealth += 20;
if (currentHealth > 100)
{
currentHealth = 100;
}
}
} }
} }
\ No newline at end of file
...@@ -124,5 +124,11 @@ namespace Nightmare ...@@ -124,5 +124,11 @@ namespace Nightmare
isDoubleSpeed = true; isDoubleSpeed = true;
speed = speed * 2; speed = speed * 2;
} }
public void DeactivateCheatDoubleSpeed()
{
isDoubleSpeed = false;
speed = speed / 2;
}
} }
} }
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment