Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / Scripts / Cheats / CheatBehaviour.cs
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class CheatBehaviour : MonoBehaviour
  5. {
  6. GameObject player;
  7. [SerializeField]GameObject window;
  8. private void Start()
  9. {
  10. player = GameObject.FindGameObjectWithTag("Player");
  11. }
  12. public void SetImmortality(bool state)
  13. {
  14. Health health;
  15. if (player.TryGetComponent<Health>(out health))
  16. {
  17. health.cheatImortality = state;
  18. }
  19. }
  20. public void SetNoCip(bool state)
  21. {
  22. CharacterMovement cm;
  23. if (player.TryGetComponent<CharacterMovement>(out cm))
  24. {
  25. cm.SetNoClip(state);
  26. }
  27. }
  28. public void AutoRefillMana(bool state)
  29. {
  30. Mana cm;
  31. if (player.TryGetComponent<Mana>(out cm))
  32. {
  33. cm.instaRegen = state;
  34. }
  35. }
  36. public void Show()
  37. {
  38. window.SetActive(true);
  39. }
  40. public void Close()
  41. {
  42. window.SetActive(false);
  43. }
  44. private void OnDisable()
  45. {
  46. window.SetActive(false);
  47. }
  48. }