Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class fallOfWorldScript : MonoBehaviour {
- health health;
- public void Start()
- {
- health = (health)GameObject.Find("player").GetComponent(typeof(health)); // grabs the players health script that is on the player
- }
- public void OnTriggerEnter(Collider other)
- {
- if(other.gameObject.tag == "player") //check if the player is colliding
- {
- health.playerHealth = -10; //set the player health to -10 because it will kill the player
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement