Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.55 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. public class fallOfWorldScript : MonoBehaviour {
  4.     health health;
  5.     public void Start()
  6.     {
  7.         health = (health)GameObject.Find("player").GetComponent(typeof(health)); // grabs the players health script that is on the player
  8.     }
  9.     public void OnTriggerEnter(Collider other)
  10.     {
  11.         if(other.gameObject.tag == "player")  //check if the player is colliding
  12.         {
  13.              health.playerHealth = -10; //set the player health to -10 because it will kill the player
  14.         }
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement