Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / Scripts / Cheats / CheatBehaviour.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CheatBehaviour : MonoBehaviour
{
    GameObject player;
    [SerializeField]GameObject window;
    private void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");
    }

    public void SetImmortality(bool state)
    {
        Health health;
        if (player.TryGetComponent<Health>(out health))
        {
            health.cheatImortality = state;
        }
    }

    public void SetNoCip(bool state)
    {
        CharacterMovement cm;
        if (player.TryGetComponent<CharacterMovement>(out cm))
        {
            cm.SetNoClip(state);
        }
    }
    public void AutoRefillMana(bool state)
    {
        Mana cm;
        if (player.TryGetComponent<Mana>(out cm))
        {
            cm.instaRegen = state;
        }
    }
    public void Show()
    {
        window.SetActive(true);
    }

    public void Close()
    {
        window.SetActive(false);
    }

    private void OnDisable()
    {
        window.SetActive(false);
    }
}