Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

BCE0005: Unknown identifier: 'DirectionRay'.

$
0
0
The errors: Assets/Scripts/Shoot.js(73,36): BCE0005: Unknown identifier: 'DirectionRay'. Assets/Scripts/Shoot.js(74,41): BCE0005: Unknown identifier: 'DirectionRay'. Assets/Scripts/Shoot.js(83,35): BCE0005: Unknown identifier: 'DirectionRay'. var Range : float = 1000; var Force : float = 1000; var Clips : int = 2; var BulletsPerClip : int = 16; var ReloadTimer : float = 0; var ReloadCooler : float = 3.3; var Damage : int = 10; var BulletsLeft : int = 16; var ShootTimer : float = 0; var ShootCooler : float = 0.09; public var ShootSound : AudioClip; public var ReloadSound : AudioClip; public var EmptySound : AudioClip; var HitParticles : ParticleEmitter; function Start () { BulletsLeft = BulletsPerClip; HitParticles.emit = false; } function Update () { if(ReloadTimer > 0) { ReloadTimer -= Time.deltaTime; } if(ReloadTimer < 0) { ReloadTimer = 0; } if(ShootTimer > 0) { ShootTimer -= Time.deltaTime; } if(ShootTimer < 0) { ShotTimer = 0; } if (BulletsLeft < 0) { BulletsLeft = 0; } if(Input.GetMouseButtonDown(0) && ShotTimer == 0) { if(BulletsLeft > 0) { if( ShootTimer == 0) { PlayShotSound(); ShootTimer = ShootCooler; Shot(); BulletsLeft --; } } if(BulletsLeft == 0 && Clips == 0) { if( ShootTimer == 0) { PlayEmptySound(); ShootTimer = ShootCooler; } } if(BulletsLeft == 0 && Clips > 0 && ReloadTimer == 0) { PlayReloadSound(); Reload(); } } } function Shot () { var Hit : RaycastHit; var DirectionRav = transform.TransformDirection(Vector3.forward); Debug.DrawRay(transform.position , DirectionRay * Range , Color.red); if(Physics.Raycast(transform.position , DirectionRay , Hit, Range)) { if(Hit.rigidbody) { if(HitParticles) { HitParticles.transform.position = Hit.point; HitParticles.transform.localRotation = Quaternion.FromToRotation(Vector3.forward, Hit.normal); HitParticles.Emit (); Hit.rigidbody.AddForceAtPosition( DirectionRay * Force , Hit.point); HitParticles.collider.SendMessageUpwards ("ApplyDamage" , Damage, SendMessageOptions.DontRequireReceiver); } } } } function Reload () { ReloadTimer = ReloadCooler; yield WaitForSeconds(ReloadTimer); BulletsLeft = BulletsPerClip; Clips --; } function PlayShotSound () { audio.PlayOneShot (ShootSound); } function PlayReloadSound () { audio.PlayOneShot (ReloadSound); } function PlayEmptySound () { audio.PlayOneShot (EmptySound); }

Viewing all articles
Browse latest Browse all 7934

Trending Articles



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