using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerStats : CharacterStats
{ public int Health = 100;
Animator anim;
public GameObject player;
PLayerMovement movScript; //the script that i want to disable
void Start()
{
health = 100;
maxHealth = 100;
mana = 100;
maxMana = 100;
stamina = 100;
maxStamina = 100;
damage = 25;
attackSpeed = 1f;
}
void Update()
{
anim = GetComponent<Animator>();
GameObject player = GetComponent<GameObject>();
movScript = GetComponent<PLayerMovement>(); //refrence to the script
}
public override void Die() //the function when dead
{
if (health <= 0)
{
Debug.Log("Player Dead");
anim.SetBool("isdead", true);
movScript.enabled = false; //the disabling doesn't work here
Destroy(player, 4f);
}
}
}