Advertisement
kasru

Select Enemies

Feb 13th, 2013
1,562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //****** Donations are greatly appreciated.  ******
  2. //****** You can donate directly to Jesse through paypal at  https://www.paypal.me/JEtzler   ******
  3.  
  4. function Update () {
  5.  
  6.     var hit: RaycastHit;
  7.  
  8.     if(Input.GetMouseButtonDown(1) &&
  9.        Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), hit,
  10.                         Mathf.Infinity)) {
  11.  
  12.     if(hit.collider.CompareTag("minion")){
  13.         Debug.Log("select enemy1");
  14.         n = hit.collider.gameObject;
  15.         n.gameObject.tag = "minionSelected";
  16.         n.renderer.materials[0].shader = Shader.Find ("Unlit/Texture");
  17.         n.renderer.materials[1].shader = Shader.Find ("Unlit/Texture");
  18.     }
  19.  
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement