Quantcast
Channel: Answers by "cj12345"
Viewing all articles
Browse latest Browse all 8

Answer by cj12345

$
0
0
var fireButton : GUITexture; var Effect : Transform; var TheDammage = 100; function Update(){ for (var evt : Touch in Input.touches) { var HitTest1 = fireButton.HitTest(evt.position); if (evt.phase == TouchPhase.Began) { if(HitTest1){ var hit : RaycastHit; var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Screen.width*0.5, Screen.height*0.5, 0)); if (Physics.Raycast (ray, hit, 100)) { var particleClone = Instantiate(Effect, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(particleClone.gameObject, 2); hit.transform.SendMessage("ApplyDammage", TheDammage, SendMessageOptions.DontRequireReceiver); } } } } } Make a gui texture and it will be your button

Viewing all articles
Browse latest Browse all 8

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>