Newer
Older
HardPoint-Project-Abertay-University-Unity3D / Assets / Content / Developers / Miguel / MiguelToys / Cheats.cs
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using Unity.VisualScripting;
  4. using UnityEngine;
  5. public class Cheats : MonoBehaviour
  6. {
  7. bool noClip = false;
  8. [SerializeField] private int noClipLayer;
  9. [SerializeField] private int defaultLayer;
  10. HealthSystem healthSystem;
  11. StatusEffects statusEffects;
  12. float dmg = 0;
  13. void Start()
  14. {
  15. Physics.IgnoreLayerCollision(noClipLayer, defaultLayer);
  16. healthSystem= GetComponent<HealthSystem>();
  17. statusEffects= GetComponent<StatusEffects>();
  18. dmg = statusEffects.damage;
  19. }
  20. // Update is called once per frame
  21. void Update()
  22. {
  23. if (Input.anyKey)
  24. {
  25. if (Input.GetKeyDown(KeyCode.N))
  26. {
  27. if (!noClip)
  28. gameObject.layer = noClipLayer;
  29. else gameObject.layer = defaultLayer;
  30. noClip = !noClip;
  31. }
  32. if (Input.GetKeyDown(KeyCode.I))
  33. {
  34. healthSystem.immortal = !healthSystem.immortal;
  35. }
  36. if (Input.GetKeyDown(KeyCode.K))
  37. {
  38. if (statusEffects.damage == dmg) statusEffects.damage = float.MaxValue;
  39. else statusEffects.damage = dmg;
  40. }
  41. }
  42. }
  43. }