My code works perfectly in the player class, but when I try to put it in a different class, it does nothing. My player doesn't lose lifes, and he doesn't die.

Here it doesn't work:

*Spikes class*

```
using UnityEngine;
using System.Collections;

public class Spikes : MonoBehaviour
{
  SimplePlayer0 player = new SimplePlayer0();
  Animator anim;
  private bool isDead;

  void OnCollisionEnter2D(Collision2D other)
  {
    if (other.gameObject.tag == "spike" && !isDead && player.Lives <= 1 && !player.IsImmune)
    {
      player.Lives = 0;
      isDead = true;
    }
    else if (other.gameObject.tag == "spike" && player.Lives >= 1 && !player.IsImmune)
    {
      player.Lives--;
      anim.SetBool("Immume", true);
      player.IsImmune = true;
    }
  }

  void OnTriggerStay2D(Collider2D other)
  {
    if (other.tag == "spike" && !isDead && player.Lives <= 1 && !player.IsImmune)
    {
      player.Lives = 0;
      isDead = true;
    }

    else if (other.gameObject.tag == "spike" && player.Lives >= 1 && !player.IsImmune)
    {
      player.Lives--;
      anim.SetBool("Immume", true);
      player.IsImmune = true;
    }
  }

  void OnCollisionStay2D(Collision2D other)
  {
    if (other.gameObject.tag == "spike" && !isDead && player.Lives <= 1 && !player.IsImmune)
    {
      player.Lives = 0;
      isDead = true;
    }

    else if (other.gameObject.tag == "spike" && player.Lives > 1 && !player.IsImmune)
    {
      player.Lives--;
      anim.SetBool("Immune", true);
      player.IsImmune = true;
    }

    else if (other.gameObject.tag == "Underground")
    {
      isDead = true;
    }

  }

  void Dead()
  {
    if (isDead == true)
    {
      Application.LoadLevel(8);
    }
  }

}

```

*Player class*

```
using UnityEngine;
using System.Collections;

public class SimplePlayer0 : MonoBehaviour
{
  Animator anim;

  //Lives
  private int lives = 3;
  private bool isImmune;
  public float immuneCounter;
  public float immuneTime;

  //PROPERTIES

  public int Lives 
  {
    get { return lives; }
    set { lives = value; }
  }

  public bool IsImmune
  {
    get { return isImmune; }
    set { isImmune = value; }
  }

  void Start ()
  {
    anim = GetComponent<Animator>();
  }

  void Update()
  {

    if (IsImmune)
    {
      immuneCounter -= Time.deltaTime;
    }
    if (immuneCounter <= 0)
    {
      IsImmune = false;
      immuneCounter = immuneTime;     
      anim.SetBool("Immume", false);
    }

}

```

This was the original code where it did work:

```
using UnityEngine;
using System.Collections;

public class Player0 : MonoBehaviour
{
  Animator anim;

  //Lives
  public int lives = 3;
  public bool isImmune;
  public float immuneCounter;
  public float immuneTime;

  public bool isDead;

  void Start()
  {
    anim = GetComponent<Animator>();
  }

  void Update()
  {

    if (isImmune)
    {
      immuneCounter -= Time.deltaTime;
    }
    if (immuneCounter <= 0)
    {
      isImmune = false;
      immuneCounter = immuneTime;       
      anim.SetBool("Immume", false);
    }

    if (isDead == true)
    {

      Application.LoadLevel(8);

    }

  void OnCollisionEnter2D(Collision2D other)
  {
    if (other.gameObject.tag == "spike" && !isDead && lives <= 1 && !isImmune)
    {

      rigidbody2D.velocity = Vector2.zero;
      lives = 0;

      rigidbody2D.AddForce(new Vector2(0, 200)); // death animation
      isDead = true;

    }
    else if (other.gameObject.tag == "spike" && lives >= 1 && !isImmune)
    {
      lives--;
      anim.SetBool("Immume", true);
      isImmune = true;
    }
  }

  void OnTriggerStay2D(Collider2D other)
  {
    if (other.tag == "spike" && !isDead && lives <= 1 && !isImmune)
    {

      rigidbody2D.velocity = Vector2.zero;
      lives = 0;
      rigidbody2D.AddForce(new Vector2(0, 200));
      isDead = true;
    }
    else if (other.gameObject.tag == "spike" && lives >= 1 && !isImmune)
    {
      lives--;
      anim.SetBool("Immume", true);
      isImmune = true;
    }

    else if (other.gameObject.tag == "Underground")
    {
      rigidbody2D.AddForce(new Vector2(0, 200));
      isDead = true;
    }
  }

  void OnCollisionStay2D(Collision2D other)
  {
    if (other.gameObject.tag == "spike" && !isDead && lives <= 1 && !isImmune)
    {
      rigidbody2D.velocity = Vector2.zero;
      lives = 0;

      rigidbody2D.AddForce(new Vector2(0, 200));
      isDead = true;

    }
    else if (other.gameObject.tag == "spike" && lives > 1 && !isImmune)
    {
      lives--;
      anim.SetBool("Immune", true);
      isImmune = true;
    }
    else if (other.gameObject.tag == "Underground")
    {
      rigidbody2D.velocity = Vector2.zero;
      lives = 0;

      isDead = true;
    }

  }

}

```