sorry if its something stupid i'm new to this xD
ERRORS::
Assets/models/playerfootstepD.js(15,1): BCE0077: It is not possible to invoke an expression of type 'UnityEngine.AudioClip'.
Assets/models/playerfootstepD.js(49,17): BCE0077: It is not possible to invoke an expression of type 'UnityEngine.AudioClip'.
Assets/models/playerfootstepD.js(69,17): BCE0077: It is not possible to invoke an expression of type 'UnityEngine.AudioClip'.
=======================================================
#pragma strict
var walksound : AudioClip;
var isWalking : boolean = false;
var isRunning : boolean = false;
var walkcool : float = 0.6;
var walkTimer : float = 0;
function Update()
{
GetState();
walksound();
}
function GetState()
{
if ( Input.GetAxis( "Horizontal" ) || Input.GetAxis( "Vertical" ) )
{
if ( Input.GetKey( "left shift" ) || Input.GetKey( "right shift" ) )
{
// Running
isWalking = false;
isRunning = true;
}
else
{
// Walking
isWalking = true;
isRunning = false;
}
}
else
{
// Stopped
isWalking = false;
isRunning = false;
}
}
function start()
{
if(isWalking == true)
{
walkcool = 0.6;
walksound();
}
else
{
walkcool = 0.6;
}
if(walkTimer > 0)
{
walkTimer -= Time.deltaTime;
}
if (walkTimer < 0)
{
walkTimer = 0;
}
if(isRunning == true)
{
walkcool = 0.4;
walksound();
}
else
{
walkcool = 0.6;
}
}
function WalkSound()
{
if(walkTimer == 0)
{
audio.PlayOneShot(walksound);
walkTimer = walkcool;
}
}
↧