How to Cancle yield WaitForSeconds when collect object
“Player” collect “Object” i need to transform but Object is not transform but wait function time_bonus () to be tranform
I want “Player” collect Object , Object transform.position at once Do not yield WaitForSeconds
please help me. i need to transform at once !
CODE ITEM
function Start () {
yield WaitForSeconds( 2 );
transform.position.x = 0.8994522;
transform.position.y = 0.930599;
transform.position.z = 1.439522;
}
function Update () {
time_bonus ();
}
function OnCollisionEnter (collision:Collision)
{
if(collision.gameObject.tag =="player")
{
transform.position.x = -10.55767;
transform.position.y = 0.930599;
transform.position.z = 1.439522;
yield WaitForSeconds( 20 );
transform.position.x = 0.8994522;
transform.position.y = 0.930599;
transform.position.z = 1.439522;
}
}
function time_bonus ()
{
if (transform.position.x >= 0.8)
{
yield WaitForSeconds( 3 );
transform.position.x = -10.55767;
transform.position.y = 0.930599;
transform.position.z = 1.439522;
yield WaitForSeconds( 3 );
transform.position.x = 0.8994522;
transform.position.y = 0.930599;
transform.position.z = 1.439522;
}
}