- Home /
Question by
InvisibleBG · Oct 11, 2012 at 10:47 PM ·
3dmethodnotfound
Method not found: 'UnityEngine.AudioSource.PlayOneShoot'.
I can`t understand where i wrong. Have any ideas where i wrong in var or or idk..
var Range : float = 1000;
var Force : float = 1000;
var Clips : int = 20;
var BulletPerClip : int = 60;
var ReloadTime : float = 3.3;
var BulletsLeft : int = 0;
var ShootTimer : float = 0;
var ShootCooler : float = 0.9;
public var ShootAudio : AudioClip;
public var ReloadAudio : AudioClip;
function Start(){
BulletsLeft = BulletPerClip;
}
function Update () {
if( ShootTimer > 0){
ShootTimer -= Time.deltaTime;
}
if( ShootTimer <0){
SmoothTimer =0;
}
if(Input.GetKey(KeyCode.F)){
if(ShootTimer == 0){
PlayShootAudio();
RayShoot();
ShootTimer = ShootCooler;
}
} }
function RayShoot (){
var Hit : RaycastHit;
var DirectionRay = transform.TransformDirection(Vector3.forward);
Debug.DrawRay(transform.position , DirectionRay * Range , Color.blue);
if(Physics.Raycast(transform.position , DirectionRay , Hit, Range)){
if(Hit.rigidbody){
Hit.rigitbody.AddForceAtPosition( DirectionRay * Force , Hit.point);
} } BulletsLeft --;
if(BulletsLeft < 0){
BulletsLeft = 0;
}
if( BulletsLeft == 0 ){
Reload();
}
}
function Reload (){
PlayReloadAudio();
yield WaitForSeconds( ReloadTime);
if(Clips > 0){
BulletsLeft = BulletPerClip;
} }
function PlayShootAudio(){
audio.PlayOneShoot( ShootAudio);
}
function PlayReloadAudio(){
audio.PlayOneShoot( ReloadAudio);
}
Comment
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Guard pass throught the walls in Unity Project #1 Stealth! 1 Answer
'Set' is not a member of 'UnityEngine.Animator'. 1 Answer
iPhone game with free Unity? 1 Answer
How to Turn 3D Model Into Weapon? 1 Answer