using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemy : MonoBehaviour
{
public Animator Wall;
public AudioSource hurtSound;
public Animator animator;
public int maxHealth = 100;
int currentHealth;
public int points = 0;
public GameObject camera;
void Start()
{
currentHealth = maxHealth;
}
public void TakeDamage(int damage)
{
currentHealth -= damage;
animator.SetTrigger("hurt");
hurtSound.PlayOneShot(hurtSound.clip);
if(currentHealth <= 0)
{
Die();
}
}
void Die(){
Wall.Play("goDown");
animator.SetBool("isDead", true);
GetComponent<Collider2D>().enabled = false;
this.enabled = false;
points += 1;
Debug.Log(points);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class door : MonoBehaviour
{
void Update(){
if(Enemy.points == 3){
print("yeee");
}
}
}
i want to refrence the points int to a diferent script but i cant because of this error An object refrence is required for non-static field, method, or property Enemy.points. here is the points int
public int points = 0;
here is where i am tring to refrence it
void Update(){
if(Enemy.points == 3){
print("yeee");
}
}
but it doesnt work
help