daily pastebin goal
42%
SHARE
TWEET

Untitled

a guest Oct 23rd, 2018 71 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class SCR_RayCast : MonoBehaviour
  6. {
  7.     public float CastDistance;
  8.  
  9.     RaycastHit WhatIHit;
  10.  
  11.     public PlayerController Player;
  12.     public SCR_Enemy Enemy;
  13.  
  14.     // Use this for initialization
  15.     void Start()
  16.     {
  17.  
  18.     }
  19.  
  20.     // Update is called once per frame
  21.     void Update()
  22.     {
  23.         if (Input.GetMouseButtonDown(0))
  24.         {
  25.             if (Player.CrossbowEquip == true)
  26.             {
  27.  
  28.                 Debug.DrawRay(this.transform.position, this.transform.forward * CastDistance, Color.magenta);
  29.                 if (Physics.Raycast(this.transform.position, this.transform.forward, out WhatIHit, CastDistance))
  30.                 {
  31.                     //Debug.Log("I am hitting the " +WhatIHit.collider.gameObject.name);
  32.                     if (WhatIHit.collider.tag == "Enemy")
  33.                     {
  34.                         Enemy.e_health -= 50;
  35.                         //Destroy(WhatIHit.collider.gameObject);
  36.                     }
  37.                 }
  38.             }
  39.         }
  40.     }
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top