Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Charge : float = 2;
- public var Bar : UnityEngine.UI.Image;
- public var fillAmount: float;
- var Fuel : float = 0.00025;
- var fireLight : Light;
- function Update() {
- var up = transform.TransformDirection(Vector3.forward);
- var hit : RaycastHit;
- Debug.DrawRay(transform.position, up * 5, Color.red);
- if(Physics.Raycast(transform.position, up, hit, 5)){
- if(hit.collider.gameObject.tag == "Battery"){
- fireLight.GetComponent.<Light>().intensity += Charge;
- Bar.fillAmount = (Bar.fillAmount + Fuel);
- Destroy(hit.transform.gameObject);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment