
task Warning
{
	RedSignal;
	SoundEffect;
	let obj=SetEffectObject(tex[TEX_SYSTEM],5);
	ObjEffect_SetRenderState(obj,ADD);
	SetEffectObjectRect(obj,288,64,512,96);
	
	let v=0;
	let lp=0;
	let scale=1.75;
	Obj_SetPosition(obj,cenX,cenY);
	let alpha=64;
	while(!Obj_BeDeleted(obj))
	{
		ObjEffect_SetScale(obj,scale,scale);
		let color=255;
		ascent(a in 0..4)
		{
			ObjEffect_SetVertexColor(obj,a,alpha,color,color,color);
		}
		if(!(lp%2)){WarningEffect(v);}
		if(lp>210){Obj_Delete(obj);}
		
		v+=0.05*cos(lp*3);
		lp++;
		yield;
	}
	
	
	task WarningEffect(let vx)
	{
		Set(1);Set(-1);
		task Set(let r)
		{
			let obj=SetEffectObject(tex[TEX_SYSTEM],4);
			ObjEffect_SetRenderState(obj,ADD);
			SetEffectObjectRect(obj,288,64,512,96);
			let alpha=48;
			let v=0;
			while(!Obj_BeDeleted(obj))
			{
				ObjEffect_SetScale(obj,scale,scale);
				let color=255;
				Obj_SetPosition(obj,cenX+v,cenY);
				ascent(a in 0..4)
				{
					ObjEffect_SetVertexColor(obj,a,alpha,color,color,color);
				}
				v+=vx*r;
				alpha-=3;
				if(alpha<=0){Obj_Delete(obj);}
				yield;
			}
		}
	}
	
	task RedSignal
	{
		let obj=SetEffectObject(tex[TEX_WHITE],4);
		ObjEffect_SetRenderState(obj,ALPHA);
		SetEffectObjectRect(obj,0,0,384,448);
		let alpha=0;
		let lp=0;
		while(!Obj_BeDeleted(obj))
		{
			Obj_SetPosition(obj,cenX,cenY);
			ascent(a in 0..4)
			{
				ObjEffect_SetVertexColor(obj,a,alpha,255,32,32);
			}
			alpha+=4*cos(90-lp*4);
			lp++;
			if(lp>180){Obj_Delete(obj);}
			yield;
		}
	}
	
	task SoundEffect
	{
		loop(3)
		{
			PlaySE(se[SE_WARNING]);
			wait(70);
		}
	}
}

