Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class character : MonoBehaviour {
- #region zycie
- public static float health = 5;
- public static bool death = false;
- private static int blood = 1;
- #endregion
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- hit();
- }
- void dealdamage()
- {
- health--;
- }
- void hit()
- {
- Debug.DrawLine (transform.position, hit.point, Color.cyan);
- // do a raycast in the gun forward direction:
- if (Physics.Raycast(transform.position, transform.forward, hit)
- {
- // if something is hit, check whether it's tagged "zombie":
- if(hit.gameObject.CompareTag("human"))
- { // if so, apply damage to it
- hit.collider.SendMessageUpwards ("dealdamage", SendMessageOptions.DontRequireReceiver);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement