
//=======================================================================
//　残り時間を表示する関数集です。
//　このファイルをinclude_functionで取り込むか、
//　必要な部分をコピペして使用してください。
//=======================================================================

//=======================================================================
// ■ 画像へのパス 構成が違う場合は要変更
//-----------------------------------------------------------------------
let imgtimer = GetCurrentScriptDirectory()~ "./img/Namber01_HD.png";
//=======================================================================

//=======================================================================
// ■ 画像の切り抜き範囲指定
//-----------------------------------------------------------------------
	// ○ HD画像の切り抜き
	let TIME_RECT_01= [  0, 32, 64, 96,128,160,192,224,256,288,320];
	let TIME_RECT_02= [ 31, 63, 95,127,159,191,223,255,287,319,351];
	let TIME_RECT_03= 0;
	let TIME_RECT_04= 64;

	// ○ 通常画像の切り抜き
	//let TIME_RECT_01= [  0, 16, 32, 48, 64, 80, 96,112,128,144,160];
	//let TIME_RECT_02= [ 15, 31, 47, 63, 79, 95,111,127,143,159,175];
	//let TIME_RECT_03= 0;
	//let TIME_RECT_04= 32;

	// ○ 画像の拡大率 基本は"1.0"で固定
	let TIME_SCALE	= 1.0;
//=======================================================================

//-----------------------------------------------------------------------
// ■ 残り時間表示 [th06〜th10]
//-----------------------------------------------------------------------
task DrawTimer01 {

	CreateCommonDataArea("time");

	let Enemy	= GetEnemyBossObjectID[0];
	let id		= [ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D)];
	let rgb		= [255,255,255];
	let i		= 0;
	let timer1	= 9;
	let timer2	= 9;
	let scale1	= 1;
	let scale2	= 0;
	let scale3	= 0.25;
	let count1	= 0;
	let count2	= 0;
	let count3	= 0;
	let CenX	= GetStgFrameWidth/2.0;
	let MinY	= 0;

	LoadTexture(imgtimer);

	loop(2) {
		ObjPrim_SetTexture(id[i],imgtimer);
		Obj_SetRenderPriorityI(id[i],80);
		ObjPrim_SetPrimitiveType(id[i],PRIMITIVE_TRIANGLESTRIP);
		ObjPrim_SetVertexCount(id[i],4);
		ObjPrim_SetVertexPosition(id[i],0,-8.0,-16.0,0);
		ObjPrim_SetVertexPosition(id[i],1,-8.0, 16.0,0);
		ObjPrim_SetVertexPosition(id[i],2, 8.0,-16.0,0);
		ObjPrim_SetVertexPosition(id[i],3, 8.0, 16.0,0);
		i++;
	}
	ObjRender_SetPosition(id[0],CenX+177   ,MinY+17,0);
	ObjRender_SetPosition(id[1],CenX+177-12,MinY+17,0);

	while(!Obj_IsDeleted(Enemy)) {
		i = 0;
		timer1 = truncate(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)%10);
		timer2 = truncate((ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)%100)/10);

		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)>99) { timer1 = 9; timer2 = 9; }

		if(timer2<1) { rgb =  [255,128,128];
			if(timer1<5) { rgb =  [255, 64, 64]; scale3 = 0.5; }
		}
		else { rgb =  [255,255,255]; }

		count1++;
		if(count3>=10) { scale3 = 0; }
		if(count1>=60) { count2 = 1; count1 = 0; }
		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)<=9&&count2==1) {
			scale2 += 180/6;
			if(scale2==180) { count2 = 0; scale2 = 0; count3++; }
		}
		scale1 = 1+scale3*sin(scale2);

		SetAreaCommonData("time","time1",timer1);
		SetAreaCommonData("time","time2",timer2);

		ObjRender_SetScaleXYZ(id[0],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjRender_SetScaleXYZ(id[1],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjPrim_SetVertexUVT(id[0],0,TIME_RECT_01[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],1,TIME_RECT_01[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[0],2,TIME_RECT_02[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],3,TIME_RECT_02[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],0,TIME_RECT_01[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],1,TIME_RECT_01[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],2,TIME_RECT_02[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],3,TIME_RECT_02[timer2],TIME_RECT_04);

		loop(2) {
			ObjPrim_SetVertexColor(id[i],0,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],1,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],2,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],3,rgb[0],rgb[1],rgb[2]);
			i++;
		}
		yield;
	}
	i=0;
	loop(2) {
		Obj_Delete(id[i]);
		i++;
	}
}

//-----------------------------------------------------------------------
// ■ 残り時間表示 [th06〜th10] [遅延可能]
//-----------------------------------------------------------------------
task DrawTimer01_Ex(delay) {

	CreateCommonDataArea("time");

	let Enemy	= GetEnemyBossObjectID[0];
	let id		= [ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D)];
	let rgb		= [255,255,255];
	let i		= 0;
	let timer1	= GetAreaCommonData("time","time1",9);
	let timer2	= GetAreaCommonData("time","time2",9);
	let scale1	= 1;
	let scale2	= 0;
	let scale3	= 0.25;
	let count1	= 0;
	let count2	= 0;
	let count3	= 0;
	let d_time	= 0;
	let CenX	= GetStgFrameWidth/2.0;
	let MinY	= 0;

	LoadTexture(imgtimer);

	loop(2) {
		ObjPrim_SetTexture(id[i],imgtimer);
		Obj_SetRenderPriorityI(id[i],80);
		ObjPrim_SetPrimitiveType(id[i],PRIMITIVE_TRIANGLESTRIP);
		ObjPrim_SetVertexCount(id[i],4);
		ObjPrim_SetVertexPosition(id[i],0,-8.0,-16.0,0);
		ObjPrim_SetVertexPosition(id[i],1,-8.0, 16.0,0);
		ObjPrim_SetVertexPosition(id[i],2, 8.0,-16.0,0);
		ObjPrim_SetVertexPosition(id[i],3, 8.0, 16.0,0);
		i++;
	}
	ObjRender_SetPosition(id[0],CenX+177   ,MinY+17,0);
	ObjRender_SetPosition(id[1],CenX+177-12,MinY+17,0);

	while(!Obj_IsDeleted(Enemy)) {
		i = 0;
		d_time++;
		timer1 = truncate(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)%10);
		timer2 = truncate((ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)%100)/10);

		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)> 99) { timer1 = 9; timer2 = 9; }
		if(d_time<=delay) {
			timer1 = GetAreaCommonData("time","time1",9);
			timer2 = GetAreaCommonData("time","time2",9);
		}

		if(timer2<1) { rgb =  [255,128,128];
			if(timer1<5) { rgb =  [255, 64, 64]; scale3 = 0.5; }
		}
		else { rgb =  [255,255,255]; }

		count1++;
		if(count3>=10) { scale3 = 0; }
		if(count1>=60) { count2 = 1; count1 = 0; }
		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)<=9&&count2==1) {
			scale2 += 180/6;
			if(scale2==180) { count2 = 0; scale2 = 0; count3++; }
		}
		scale1 = 1+scale3*sin(scale2);

		SetAreaCommonData("time","time1",timer1);
		SetAreaCommonData("time","time2",timer2);

		ObjRender_SetScaleXYZ(id[0],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjRender_SetScaleXYZ(id[1],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjPrim_SetVertexUVT(id[0],0,TIME_RECT_01[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],1,TIME_RECT_01[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[0],2,TIME_RECT_02[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],3,TIME_RECT_02[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],0,TIME_RECT_01[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],1,TIME_RECT_01[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],2,TIME_RECT_02[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],3,TIME_RECT_02[timer2],TIME_RECT_04);
		loop(2) {
			ObjPrim_SetVertexColor(id[i],0,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],1,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],2,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],3,rgb[0],rgb[1],rgb[2]);
			i++;
		}
		yield;
	}
	i=0;
	loop(2) {
		Obj_Delete(id[i]);
		i++;
	}
}

//-----------------------------------------------------------------------
// ■ 残り時間表示 [th11〜th12]
//-----------------------------------------------------------------------
task DrawTimer02 {

	CreateCommonDataArea("time");

	let Enemy	= GetEnemyBossObjectID[0];
	let id		= [ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D)];
	let rgb		= [255,255,255];
	let ms		= ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)*60*(100/60)+(100/60);
	let i		= 0;
	let timer1	= 9;
	let timer2	= 9;
	let timer3	= 9;
	let timer4	= 9;
	let scale1	= 1;
	let scale2	= 0;
	let scale3	= 0.25;
	let count1	= 0;
	let count2	= 0;
	let count3	= 0;
	let CenX	= GetStgFrameWidth/2.0;
	let MinY	= 0;

	LoadTexture(imgtimer);

	loop(5) {
		ObjPrim_SetTexture(id[i],imgtimer);
		Obj_SetRenderPriorityI(id[i],80);
		ObjPrim_SetPrimitiveType(id[i],PRIMITIVE_TRIANGLESTRIP);
		ObjPrim_SetVertexCount(id[i],4);
		ObjPrim_SetVertexPosition(id[i],0,-8.0,-16.0,0);
		ObjPrim_SetVertexPosition(id[i],1,-8.0, 16.0,0);
		ObjPrim_SetVertexPosition(id[i],2, 8.0,-16.0,0);
		ObjPrim_SetVertexPosition(id[i],3, 8.0, 16.0,0);
		i++;
	}
	ObjRender_SetScaleXYZ(id[2],0.6*TIME_SCALE,0.7*TIME_SCALE,1.00);
	ObjRender_SetScaleXYZ(id[3],0.6*TIME_SCALE,0.7*TIME_SCALE,1.00);
	ObjRender_SetScaleXYZ(id[4],1.0*TIME_SCALE,1.0*TIME_SCALE,1.00);
	ObjPrim_SetVertexUVT(id[4],0,TIME_RECT_01[10],TIME_RECT_03);
	ObjPrim_SetVertexUVT(id[4],1,TIME_RECT_01[10],TIME_RECT_04);
	ObjPrim_SetVertexUVT(id[4],2,TIME_RECT_02[10],TIME_RECT_03);
	ObjPrim_SetVertexUVT(id[4],3,TIME_RECT_02[10],TIME_RECT_04);
	ObjRender_SetPosition(id[0],CenX+168   ,MinY+10,0);
	ObjRender_SetPosition(id[1],CenX+168-12,MinY+10,0);
	ObjRender_SetPosition(id[2],CenX+168+22,MinY+13,0);
	ObjRender_SetPosition(id[3],CenX+168+15,MinY+13,0);
	ObjRender_SetPosition(id[4],CenX+168+8 ,MinY+10,0);

	while(!Obj_IsDeleted(Enemy)) {
		i = 0;
		ms -= 100/60;
		timer1 = truncate(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)%10);
		timer2 = truncate((ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)%100)/10);
		timer3 = truncate(ms%10);
		timer4 = truncate((ms%100)/10);

		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)> 99) { timer1 = 9; timer2 = 9; timer3 = 9; timer4 = 9; }
		if(ms <  100/60) { timer1 = 0; timer2 = 0; timer3 = 0; timer4 = 0; }

		if(timer2<1) { rgb =  [255,128,128];
			if(timer1<5) { rgb =  [255, 64, 64]; scale3 = 0.5; }
		}
		else { rgb =  [255,255,255]; }

		count1++;
		if(count3>=10) { scale3 = 0; }
		if(count1>=60) { count2 = 1; count1 = 0; }
		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)<=9&&count2==1) {
			scale2 += 180/6;
			if(scale2==180) { count2 = 0; scale2 = 0; count3++; }
		}
		scale1 = 1+scale3*sin(scale2);

		SetAreaCommonData("time","time1",timer1);
		SetAreaCommonData("time","time2",timer2);
		SetAreaCommonData("time","time3",timer3);
		SetAreaCommonData("time","time4",timer4);

		ObjRender_SetScaleXYZ(id[0],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjRender_SetScaleXYZ(id[1],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjPrim_SetVertexUVT(id[0],0,TIME_RECT_01[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],1,TIME_RECT_01[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[0],2,TIME_RECT_02[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],3,TIME_RECT_02[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],0,TIME_RECT_01[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],1,TIME_RECT_01[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],2,TIME_RECT_02[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],3,TIME_RECT_02[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[2],0,TIME_RECT_01[timer3],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[2],1,TIME_RECT_01[timer3],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[2],2,TIME_RECT_02[timer3],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[2],3,TIME_RECT_02[timer3],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[3],0,TIME_RECT_01[timer4],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[3],1,TIME_RECT_01[timer4],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[3],2,TIME_RECT_02[timer4],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[3],3,TIME_RECT_02[timer4],TIME_RECT_04);
		loop(5) {
			ObjPrim_SetVertexColor(id[i],0,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],1,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],2,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],3,rgb[0],rgb[1],rgb[2]);
			i++;
		}
		yield;
	}
	i=0;
	loop(5) {
		Obj_Delete(id[i]);
		i++;
	}
}

//-----------------------------------------------------------------------
// ■ 残り時間表示 [th11〜th12] [遅延可能]
//-----------------------------------------------------------------------
task DrawTimer02_Ex(delay) {

	CreateCommonDataArea("time");

	let Enemy	= GetEnemyBossObjectID[0];
	let id		= [ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D)];
	let rgb		= [255,255,255];
	let ms		= ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)*60*(100/60)+(100/60);
	let i		= 0;
	let timer1	= GetAreaCommonData("time","time1",9);
	let timer2	= GetAreaCommonData("time","time2",9);
	let timer3	= GetAreaCommonData("time","time3",9);
	let timer4	= GetAreaCommonData("time","time4",9);
	let scale1	= 1;
	let scale2	= 0;
	let scale3	= 0.25;
	let count1	= 0;
	let count2	= 0;
	let count3	= 0;
	let d_time	= 0;
	let CenX	= GetStgFrameWidth/2.0;
	let MinY	= 0;

	LoadTexture(imgtimer);

	loop(5) {
		ObjPrim_SetTexture(id[i],imgtimer);
		Obj_SetRenderPriorityI(id[i],80);
		ObjPrim_SetPrimitiveType(id[i],PRIMITIVE_TRIANGLESTRIP);
		ObjPrim_SetVertexCount(id[i],4);
		ObjPrim_SetVertexPosition(id[i],0,-8.0,-16.0,0);
		ObjPrim_SetVertexPosition(id[i],1,-8.0, 16.0,0);
		ObjPrim_SetVertexPosition(id[i],2, 8.0,-16.0,0);
		ObjPrim_SetVertexPosition(id[i],3, 8.0, 16.0,0);
		i++;
	}
	ObjRender_SetScaleXYZ(id[2],0.6*TIME_SCALE,0.7*TIME_SCALE,1.00);
	ObjRender_SetScaleXYZ(id[3],0.6*TIME_SCALE,0.7*TIME_SCALE,1.00);
	ObjRender_SetScaleXYZ(id[4],1.0*TIME_SCALE,1.0*TIME_SCALE,1.00);
	ObjPrim_SetVertexUVT(id[4],0,TIME_RECT_01[10],TIME_RECT_03);
	ObjPrim_SetVertexUVT(id[4],1,TIME_RECT_01[10],TIME_RECT_04);
	ObjPrim_SetVertexUVT(id[4],2,TIME_RECT_02[10],TIME_RECT_03);
	ObjPrim_SetVertexUVT(id[4],3,TIME_RECT_02[10],TIME_RECT_04);
	ObjRender_SetPosition(id[0],CenX+168   ,MinY+10,0);
	ObjRender_SetPosition(id[1],CenX+168-12,MinY+10,0);
	ObjRender_SetPosition(id[2],CenX+168+22,MinY+13,0);
	ObjRender_SetPosition(id[3],CenX+168+15,MinY+13,0);
	ObjRender_SetPosition(id[4],CenX+168+8 ,MinY+10,0);

	while(!Obj_IsDeleted(Enemy)) {
		i = 0;
		d_time++;
		ms -= 100/60;
		timer1 = truncate(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)%10);
		timer2 = truncate((ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)%100)/10);
		timer3 = truncate(ms%10);
		timer4 = truncate((ms%100)/10);

		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)> 99) { timer1 = 9; timer2 = 9; timer3 = 9; timer4 = 9; }
		if(ms <  100/60) { timer1 = 0; timer2 = 0; timer3 = 0; timer4 = 0; }
		if(d_time<=delay) {
			timer1 = GetAreaCommonData("time","time1",9);
			timer2 = GetAreaCommonData("time","time2",9);
			timer3 = GetAreaCommonData("time","time3",9);
			timer4 = GetAreaCommonData("time","time4",9);
		}

		if(timer2<1) { rgb =  [255,128,128];
			if(timer1<5) { rgb =  [255, 64, 64]; scale3 = 0.5; }
		}
		else { rgb =  [255,255,255]; }

		count1++;
		if(count3>=10) { scale3 = 0; }
		if(count1>=60) { count2 = 1; count1 = 0; }
		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)<=9&&count2==1) {
			scale2 += 180/6;
			if(scale2==180) { count2 = 0; scale2 = 0; count3++; }
		}
		scale1 = 1+scale3*sin(scale2);

		SetAreaCommonData("time","time1",timer1);
		SetAreaCommonData("time","time2",timer2);
		SetAreaCommonData("time","time3",timer3);
		SetAreaCommonData("time","time4",timer4);

		ObjRender_SetScaleXYZ(id[0],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjRender_SetScaleXYZ(id[1],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjPrim_SetVertexUVT(id[0],0,TIME_RECT_01[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],1,TIME_RECT_01[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[0],2,TIME_RECT_02[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],3,TIME_RECT_02[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],0,TIME_RECT_01[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],1,TIME_RECT_01[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],2,TIME_RECT_02[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],3,TIME_RECT_02[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[2],0,TIME_RECT_01[timer3],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[2],1,TIME_RECT_01[timer3],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[2],2,TIME_RECT_02[timer3],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[2],3,TIME_RECT_02[timer3],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[3],0,TIME_RECT_01[timer4],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[3],1,TIME_RECT_01[timer4],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[3],2,TIME_RECT_02[timer4],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[3],3,TIME_RECT_02[timer4],TIME_RECT_04);
		loop(5) {
			ObjPrim_SetVertexColor(id[i],0,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],1,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],2,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],3,rgb[0],rgb[1],rgb[2]);
			i++;
		}
		yield;
	}
	i=0;
	loop(5) {
		Obj_Delete(id[i]);
		i++;
	}
}

//-----------------------------------------------------------------------
// ■ 残り時間表示 [th13〜th14]
//-----------------------------------------------------------------------
task DrawTimer03(type) {

	CreateCommonDataArea("time");

	let Enemy	= GetEnemyBossObjectID[0];
	let id		= [ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D)];
	let rgb		= [255,255,255];
	let ms		= ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)*60*(100/60)+(100/60);
	let py		= 0;
	let i		= 0;
	let timer1	= 9;
	let timer2	= 9;
	let timer3	= 9;
	let timer4	= 9;
	let scale1	= 1;
	let scale2	= 0;
	let scale3	= 0.25;
	let count1	= 0;
	let count2	= 0;
	let count3	= 0;
	let t_count	= 0;
	let t_alpha	= 255;
	let CenX	= GetStgFrameWidth/2.0+32;
	let MinY	= GetStgFrameTop();

	LoadTexture(imgtimer);
	
	loop(5) {
		ObjPrim_SetTexture(id[i],imgtimer);
		Obj_SetRenderPriorityI(id[i],85);
		ObjPrim_SetPrimitiveType(id[i],PRIMITIVE_TRIANGLESTRIP);
		ObjPrim_SetVertexCount(id[i],4);
		ObjPrim_SetVertexPosition(id[i],0,-8.0,-16.0,0);
		ObjPrim_SetVertexPosition(id[i],1,-8.0, 16.0,0);
		ObjPrim_SetVertexPosition(id[i],2, 8.0,-16.0,0);
		ObjPrim_SetVertexPosition(id[i],3, 8.0, 16.0,0);
		i++;
	}
	ObjRender_SetScaleXYZ(id[2],0.6*TIME_SCALE,0.7*TIME_SCALE,1.00);
	ObjRender_SetScaleXYZ(id[3],0.6*TIME_SCALE,0.7*TIME_SCALE,1.00);
	ObjRender_SetScaleXYZ(id[4],1.0*TIME_SCALE,1.0*TIME_SCALE,1.00);
	ObjPrim_SetVertexUVT(id[4],0,TIME_RECT_01[10],TIME_RECT_03);
	ObjPrim_SetVertexUVT(id[4],1,TIME_RECT_01[10],TIME_RECT_04);
	ObjPrim_SetVertexUVT(id[4],2,TIME_RECT_02[10],TIME_RECT_03);
	ObjPrim_SetVertexUVT(id[4],3,TIME_RECT_02[10],TIME_RECT_04);

	if(type==2) { t_alpha = 0; }

	while(t_count<90&&!Obj_IsDeleted(Enemy)) {
		i = 0;
		ms -= 100/60;
		t_count += 90/60;
		timer1 = truncate(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)%10);
		timer2 = truncate((ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)%100)/10);
		timer3 = truncate(ms%10);
		timer4 = truncate((ms%100)/10);

		if(t_alpha <255) { t_alpha += 255/30; }
		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)> 99) { timer1 = 9; timer2 = 9; timer3 = 9; timer4 = 9; }
		if(ms <  100/60) { timer1 = 0; timer2 = 0; timer3 = 0; timer4 = 0; }

		if(timer2<1) { rgb =  [255,128,128];
			if(timer1<5) { rgb =  [255, 64, 64]; scale3 = 0.5; }
		}
		else { rgb =  [255,255,255]; }

		count1++;
		if(count3>=10) { scale3 = 0; }
		if(count1>=60) { count2 = 1; count1 = 0; }
		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)<=9&&count2==1) {
			scale2 += 180/6;
			if(scale2==180) { count2 = 0; scale2 = 0; count3++; }
		}
		scale1 = 1+scale3*sin(scale2);

		alternative(type)
		case(0) { py = -32*sin(t_count)+32; }
		case(1) { py =  32*sin(t_count); }
		case(2) { py =  16; }
		case(3) { py = -16*sin(t_count)+16; }
		case(4) { py =  16*sin(t_count); }
		case(5) { py =  32; }
		case(6) { py =  0;  }
		case(7) { py =  32; }

		SetAreaCommonData("time","time1",timer1);
		SetAreaCommonData("time","time2",timer2);
		SetAreaCommonData("time","time3",timer3);
		SetAreaCommonData("time","time4",timer4);

		ObjRender_SetPosition(id[0],CenX   ,MinY+10+py,0);
		ObjRender_SetPosition(id[1],CenX-12,MinY+10+py,0);
		ObjRender_SetPosition(id[2],CenX+22,MinY+13+py,0);
		ObjRender_SetPosition(id[3],CenX+15,MinY+13+py,0);
		ObjRender_SetPosition(id[4],CenX+8 ,MinY+10+py,0);
		ObjRender_SetScaleXYZ(id[0],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjRender_SetScaleXYZ(id[1],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjPrim_SetVertexUVT(id[0],0,TIME_RECT_01[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],1,TIME_RECT_01[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[0],2,TIME_RECT_02[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],3,TIME_RECT_02[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],0,TIME_RECT_01[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],1,TIME_RECT_01[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],2,TIME_RECT_02[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],3,TIME_RECT_02[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[2],0,TIME_RECT_01[timer3],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[2],1,TIME_RECT_01[timer3],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[2],2,TIME_RECT_02[timer3],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[2],3,TIME_RECT_02[timer3],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[3],0,TIME_RECT_01[timer4],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[3],1,TIME_RECT_01[timer4],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[3],2,TIME_RECT_02[timer4],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[3],3,TIME_RECT_02[timer4],TIME_RECT_04);
		loop(5) {
			ObjPrim_SetVertexAlpha(id[i],0,t_alpha);
			ObjPrim_SetVertexAlpha(id[i],1,t_alpha);
			ObjPrim_SetVertexAlpha(id[i],2,t_alpha);
			ObjPrim_SetVertexAlpha(id[i],3,t_alpha);
			ObjPrim_SetVertexColor(id[i],0,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],1,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],2,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],3,rgb[0],rgb[1],rgb[2]);
			i++;
		}
		yield;
	}
	while(!Obj_IsDeleted(Enemy)) {
		i = 0;
		ms -= 100/60;
		timer1 = truncate(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)%10);
		timer2 = truncate((ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)%100)/10);
		timer3 = truncate(ms%10);
		timer4 = truncate((ms%100)/10);

		if(t_alpha <255) { t_alpha += 255/30; }
		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)> 99) { timer1 = 9; timer2 = 9; timer3 = 9; timer4 = 9; }
		if(ms <  100/60) { timer1 = 0; timer2 = 0; timer3 = 0; timer4 = 0; }

		if(timer2<1) { rgb =  [255,128,128];
			if(timer1<5) { rgb =  [255, 64, 64]; scale3 = 0.5; }
		}
		else { rgb =  [255,255,255]; }

		count1++;
		if(count3>=10) { scale3 = 0; }
		if(count1>=60) { count2 = 1; count1 = 0; }
		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)<=9&&count2==1) {
			scale2 += 180/6;
			if(scale2==180) { count2 = 0; scale2 = 0; count3++; }
		}
		scale1 = 1+scale3*sin(scale2);

		SetAreaCommonData("time","time1",timer1);
		SetAreaCommonData("time","time2",timer2);
		SetAreaCommonData("time","time3",timer3);
		SetAreaCommonData("time","time4",timer4);

		ObjRender_SetPosition(id[0],CenX   ,MinY+10+py,0);
		ObjRender_SetPosition(id[1],CenX-12,MinY+10+py,0);
		ObjRender_SetPosition(id[2],CenX+22,MinY+13+py,0);
		ObjRender_SetPosition(id[3],CenX+15,MinY+13+py,0);
		ObjRender_SetPosition(id[4],CenX+8 ,MinY+10+py,0);
		ObjRender_SetScaleXYZ(id[0],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjRender_SetScaleXYZ(id[1],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjPrim_SetVertexUVT(id[0],0,TIME_RECT_01[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],1,TIME_RECT_01[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[0],2,TIME_RECT_02[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],3,TIME_RECT_02[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],0,TIME_RECT_01[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],1,TIME_RECT_01[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],2,TIME_RECT_02[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],3,TIME_RECT_02[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[2],0,TIME_RECT_01[timer3],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[2],1,TIME_RECT_01[timer3],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[2],2,TIME_RECT_02[timer3],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[2],3,TIME_RECT_02[timer3],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[3],0,TIME_RECT_01[timer4],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[3],1,TIME_RECT_01[timer4],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[3],2,TIME_RECT_02[timer4],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[3],3,TIME_RECT_02[timer4],TIME_RECT_04);
		loop(5) {
			ObjPrim_SetVertexAlpha(id[i],0,t_alpha);
			ObjPrim_SetVertexAlpha(id[i],1,t_alpha);
			ObjPrim_SetVertexAlpha(id[i],2,t_alpha);
			ObjPrim_SetVertexAlpha(id[i],3,t_alpha);
			ObjPrim_SetVertexColor(id[i],0,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],1,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],2,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],3,rgb[0],rgb[1],rgb[2]);
			i++;
		}
		yield;
	}
	i=0;
	loop(5) {
		Obj_Delete(id[i]);
		i++;
	}
}

//-----------------------------------------------------------------------
// ■ 残り時間表示 [th13〜th14] [遅延可能]
//-----------------------------------------------------------------------
task DrawTimer03_Ex(type,delay) {

	CreateCommonDataArea("time");

	let Enemy	= GetEnemyBossObjectID[0];
	let id		= [ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D)];
	let rgb		= [255,255,255];
	let ms		= ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)*60*(100/60)+(100/60);
	let py		= 0;
	let i		= 0;
	let timer1	= GetAreaCommonData("time","time1",9);
	let timer2	= GetAreaCommonData("time","time2",9);
	let timer3	= GetAreaCommonData("time","time3",9);
	let timer4	= GetAreaCommonData("time","time4",9);
	let scale1	= 1;
	let scale2	= 0;
	let scale3	= 0.25;
	let count1	= 0;
	let count2	= 0;
	let count3	= 0;
	let d_time	= 0;
	let t_count	= 0;
	let t_alpha	= 255;
	let CenX	= GetStgFrameWidth/2.0+32;
	let MinY	= GetStgFrameTop();

	LoadTexture(imgtimer);

	loop(5) {
		ObjPrim_SetTexture(id[i],imgtimer);
		Obj_SetRenderPriorityI(id[i],85);
		ObjPrim_SetPrimitiveType(id[i],PRIMITIVE_TRIANGLESTRIP);
		ObjPrim_SetVertexCount(id[i],4);
		ObjPrim_SetVertexPosition(id[i],0,-8.0,-16.0,0);
		ObjPrim_SetVertexPosition(id[i],1,-8.0, 16.0,0);
		ObjPrim_SetVertexPosition(id[i],2, 8.0,-16.0,0);
		ObjPrim_SetVertexPosition(id[i],3, 8.0, 16.0,0);
		i++;
	}
	ObjRender_SetScaleXYZ(id[2],0.6*TIME_SCALE,0.7*TIME_SCALE,1.00);
	ObjRender_SetScaleXYZ(id[3],0.6*TIME_SCALE,0.7*TIME_SCALE,1.00);
	ObjRender_SetScaleXYZ(id[4],1.0*TIME_SCALE,1.0*TIME_SCALE,1.00);
	ObjPrim_SetVertexUVT(id[4],0,TIME_RECT_01[10],TIME_RECT_03);
	ObjPrim_SetVertexUVT(id[4],1,TIME_RECT_01[10],TIME_RECT_04);
	ObjPrim_SetVertexUVT(id[4],2,TIME_RECT_02[10],TIME_RECT_03);
	ObjPrim_SetVertexUVT(id[4],3,TIME_RECT_02[10],TIME_RECT_04);

	if(type==2) { t_alpha = 0; }

	while(d_time<=delay&&t_count<90&&!Obj_IsDeleted(Enemy)) {
		i = 0;
		d_time++;
		ms -= 100/60;
		t_count += 90/60;

		if(t_alpha <255) { t_alpha += 255/30; }

		if(timer2<1) { rgb =  [255,128,128];
			if(timer1<5) { rgb =  [255, 64, 64]; scale3 = 0.5; }
		}
		else { rgb =  [255,255,255]; }

		count1++;
		if(count3>=10) { scale3 = 0; }
		if(count1>=60) { count2 = 1; count1 = 0; }
		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)<=9&&count2==1) {
			scale2 += 180/6;
			if(scale2==180) { count2 = 0; scale2 = 0; count3++; }
		}
		scale1 = 1+scale3*sin(scale2);

		alternative(type)
		case(0) { py = -32*sin(t_count)+32; }
		case(1) { py =  32*sin(t_count); }
		case(2) { py =  16; }
		case(3) { py = -16*sin(t_count)+16; }
		case(4) { py =  16*sin(t_count)+16; }
		case(5) { py = -32*sin(t_count)+32; }
		case(6) { py =  0;  }
		case(7) { py =  32; }

		SetAreaCommonData("time","time1",timer1);
		SetAreaCommonData("time","time2",timer2);
		SetAreaCommonData("time","time3",timer3);
		SetAreaCommonData("time","time4",timer4);

		ObjRender_SetPosition(id[0],CenX   ,MinY+10+py,0);
		ObjRender_SetPosition(id[1],CenX-12,MinY+10+py,0);
		ObjRender_SetPosition(id[2],CenX+22,MinY+13+py,0);
		ObjRender_SetPosition(id[3],CenX+15,MinY+13+py,0);
		ObjRender_SetPosition(id[4],CenX+8 ,MinY+10+py,0);
		ObjRender_SetScaleXYZ(id[0],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjRender_SetScaleXYZ(id[1],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjPrim_SetVertexUVT(id[0],0,TIME_RECT_01[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],1,TIME_RECT_01[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[0],2,TIME_RECT_02[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],3,TIME_RECT_02[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],0,TIME_RECT_01[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],1,TIME_RECT_01[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],2,TIME_RECT_02[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],3,TIME_RECT_02[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[2],0,TIME_RECT_01[timer3],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[2],1,TIME_RECT_01[timer3],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[2],2,TIME_RECT_02[timer3],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[2],3,TIME_RECT_02[timer3],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[3],0,TIME_RECT_01[timer4],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[3],1,TIME_RECT_01[timer4],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[3],2,TIME_RECT_02[timer4],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[3],3,TIME_RECT_02[timer4],TIME_RECT_04);
		loop(5) {
			ObjPrim_SetVertexAlpha(id[i],0,t_alpha);
			ObjPrim_SetVertexAlpha(id[i],1,t_alpha);
			ObjPrim_SetVertexAlpha(id[i],2,t_alpha);
			ObjPrim_SetVertexAlpha(id[i],3,t_alpha);
			ObjPrim_SetVertexColor(id[i],0,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],1,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],2,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],3,rgb[0],rgb[1],rgb[2]);
			i++;
		}
		yield;
	}
	while(d_time<=delay&&!Obj_IsDeleted(Enemy)) {
		i = 0;
		d_time++;
		ms -= 100/60;

		if(t_alpha <255) { t_alpha += 255/30; }

		if(timer2<1) { rgb =  [255,128,128];
			if(timer1<5) { rgb =  [255, 64, 64]; scale3 = 0.5; }
		}
		else { rgb =  [255,255,255]; }

		count1++;
		if(count3>=10) { scale3 = 0; }
		if(count1>=60) { count2 = 1; count1 = 0; }
		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)<=9&&count2==1) {
			scale2 += 180/6;
			if(scale2==180) { count2 = 0; scale2 = 0; count3++; }
		}
		scale1 = 1+scale3*sin(scale2);

		SetAreaCommonData("time","time1",timer1);
		SetAreaCommonData("time","time2",timer2);
		SetAreaCommonData("time","time3",timer3);
		SetAreaCommonData("time","time4",timer4);

		ObjRender_SetPosition(id[0],CenX   ,MinY+10+py,0);
		ObjRender_SetPosition(id[1],CenX-12,MinY+10+py,0);
		ObjRender_SetPosition(id[2],CenX+22,MinY+13+py,0);
		ObjRender_SetPosition(id[3],CenX+15,MinY+13+py,0);
		ObjRender_SetPosition(id[4],CenX+8 ,MinY+10+py,0);
		ObjRender_SetScaleXYZ(id[0],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjRender_SetScaleXYZ(id[1],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjPrim_SetVertexUVT(id[0],0,TIME_RECT_01[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],1,TIME_RECT_01[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[0],2,TIME_RECT_02[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],3,TIME_RECT_02[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],0,TIME_RECT_01[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],1,TIME_RECT_01[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],2,TIME_RECT_02[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],3,TIME_RECT_02[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[2],0,TIME_RECT_01[timer3],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[2],1,TIME_RECT_01[timer3],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[2],2,TIME_RECT_02[timer3],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[2],3,TIME_RECT_02[timer3],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[3],0,TIME_RECT_01[timer4],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[3],1,TIME_RECT_01[timer4],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[3],2,TIME_RECT_02[timer4],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[3],3,TIME_RECT_02[timer4],TIME_RECT_04);
		loop(5) {
			ObjPrim_SetVertexAlpha(id[i],0,t_alpha);
			ObjPrim_SetVertexAlpha(id[i],1,t_alpha);
			ObjPrim_SetVertexAlpha(id[i],2,t_alpha);
			ObjPrim_SetVertexAlpha(id[i],3,t_alpha);
			ObjPrim_SetVertexColor(id[i],0,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],1,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],2,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],3,rgb[0],rgb[1],rgb[2]);
			i++;
		}
		yield;
	}
	t_count = 0;
	while(t_count<90&&!Obj_IsDeleted(Enemy)) {
		i = 0;
		ms -= 100/60;
		t_count += 90/60;
		timer1 = truncate(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)%10);
		timer2 = truncate((ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)%100)/10);
		timer3 = truncate(ms%10);
		timer4 = truncate((ms%100)/10);

		if(t_alpha <255) { t_alpha += 255/30; }
		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)> 99) { timer1 = 9; timer2 = 9; timer3 = 9; timer4 = 9; }
		if(ms <  100/60) { timer1 = 0; timer2 = 0; timer3 = 0; timer4 = 0; }

		if(timer2<1) { rgb =  [255,128,128];
			if(timer1<5) { rgb =  [255, 64, 64]; scale3 = 0.5; }
		}
		else { rgb =  [255,255,255]; }

		count1++;
		if(count3>=10) { scale3 = 0; }
		if(count1>=60) { count2 = 1; count1 = 0; }
		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)<=9&&count2==1) {
			scale2 += 180/6;
			if(scale2==180) { count2 = 0; scale2 = 0; count3++; }
		}
		scale1 = 1+scale3*sin(scale2);

		alternative(type)
		case(5) { py = 32*sin(t_count); }

		SetAreaCommonData("time","time1",timer1);
		SetAreaCommonData("time","time2",timer2);
		SetAreaCommonData("time","time3",timer3);
		SetAreaCommonData("time","time4",timer4);

		ObjRender_SetPosition(id[0],CenX   ,MinY+10+py,0);
		ObjRender_SetPosition(id[1],CenX-12,MinY+10+py,0);
		ObjRender_SetPosition(id[2],CenX+22,MinY+13+py,0);
		ObjRender_SetPosition(id[3],CenX+15,MinY+13+py,0);
		ObjRender_SetPosition(id[4],CenX+8 ,MinY+10+py,0);
		ObjRender_SetScaleXYZ(id[0],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjRender_SetScaleXYZ(id[1],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjPrim_SetVertexUVT(id[0],0,TIME_RECT_01[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],1,TIME_RECT_01[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[0],2,TIME_RECT_02[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],3,TIME_RECT_02[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],0,TIME_RECT_01[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],1,TIME_RECT_01[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],2,TIME_RECT_02[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],3,TIME_RECT_02[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[2],0,TIME_RECT_01[timer3],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[2],1,TIME_RECT_01[timer3],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[2],2,TIME_RECT_02[timer3],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[2],3,TIME_RECT_02[timer3],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[3],0,TIME_RECT_01[timer4],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[3],1,TIME_RECT_01[timer4],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[3],2,TIME_RECT_02[timer4],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[3],3,TIME_RECT_02[timer4],TIME_RECT_04);
		loop(5) {
			ObjPrim_SetVertexAlpha(id[i],0,t_alpha);
			ObjPrim_SetVertexAlpha(id[i],1,t_alpha);
			ObjPrim_SetVertexAlpha(id[i],2,t_alpha);
			ObjPrim_SetVertexAlpha(id[i],3,t_alpha);
			ObjPrim_SetVertexColor(id[i],0,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],1,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],2,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],3,rgb[0],rgb[1],rgb[2]);
			i++;
		}
		yield;
	}
	while(!Obj_IsDeleted(Enemy)) {
		i = 0;
		ms -= 100/60;
		timer1 = truncate(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)%10);
		timer2 = truncate((ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)%100)/10);
		timer3 = truncate(ms%10);
		timer4 = truncate((ms%100)/10);

		if(t_alpha <255) { t_alpha += 255/30; }
		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)> 99) { timer1 = 9; timer2 = 9; timer3 = 9; timer4 = 9; }
		if(ms <  100/60) { timer1 = 0; timer2 = 0; timer3 = 0; timer4 = 0; }

		if(timer2<1) { rgb =  [255,128,128];
			if(timer1<5) { rgb =  [255, 64, 64]; scale3 = 0.5; }
		}
		else { rgb =  [255,255,255]; }

		count1++;
		if(count3>=10) { scale3 = 0; }
		if(count1>=60) { count2 = 1; count1 = 0; }
		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)<=9&&count2==1) {
			scale2 += 180/6;
			if(scale2==180) { count2 = 0; scale2 = 0; count3++; }
		}
		scale1 = 1+scale3*sin(scale2);

		SetAreaCommonData("time","time1",timer1);
		SetAreaCommonData("time","time2",timer2);
		SetAreaCommonData("time","time3",timer3);
		SetAreaCommonData("time","time4",timer4);

		ObjRender_SetPosition(id[0],CenX   ,MinY+10+py,0);
		ObjRender_SetPosition(id[1],CenX-12,MinY+10+py,0);
		ObjRender_SetPosition(id[2],CenX+22,MinY+13+py,0);
		ObjRender_SetPosition(id[3],CenX+15,MinY+13+py,0);
		ObjRender_SetPosition(id[4],CenX+8 ,MinY+10+py,0);
		ObjRender_SetScaleXYZ(id[0],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjRender_SetScaleXYZ(id[1],scale1*TIME_SCALE,scale1*TIME_SCALE,1.00);
		ObjPrim_SetVertexUVT(id[0],0,TIME_RECT_01[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],1,TIME_RECT_01[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[0],2,TIME_RECT_02[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],3,TIME_RECT_02[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],0,TIME_RECT_01[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],1,TIME_RECT_01[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],2,TIME_RECT_02[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],3,TIME_RECT_02[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[2],0,TIME_RECT_01[timer3],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[2],1,TIME_RECT_01[timer3],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[2],2,TIME_RECT_02[timer3],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[2],3,TIME_RECT_02[timer3],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[3],0,TIME_RECT_01[timer4],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[3],1,TIME_RECT_01[timer4],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[3],2,TIME_RECT_02[timer4],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[3],3,TIME_RECT_02[timer4],TIME_RECT_04);
		loop(5) {
			ObjPrim_SetVertexAlpha(id[i],0,t_alpha);
			ObjPrim_SetVertexAlpha(id[i],1,t_alpha);
			ObjPrim_SetVertexAlpha(id[i],2,t_alpha);
			ObjPrim_SetVertexAlpha(id[i],3,t_alpha);
			ObjPrim_SetVertexColor(id[i],0,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],1,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],2,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],3,rgb[0],rgb[1],rgb[2]);
			i++;
		}
		yield;
	}
	i=0;
	loop(5) {
		Obj_Delete(id[i]);
		i++;
	}
}

//-----------------------------------------------------------------------
// ■ 残り時間表示 [オリジナル] [th11〜th12に近い形式]
//-----------------------------------------------------------------------
task DrawTimer {

	CreateCommonDataArea("time");

	let Enemy	= GetEnemyBossObjectID[0];
	let id		= [ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D), ObjPrim_Create(OBJ_PRIMITIVE_2D)];
	let rgb		= [255,255,255];
	let ms		= ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)*60*(100/60)+(100/60);
	let i		= 0;
	let timer1	= 9;
	let timer2	= 9;
	let timer3	= 9;
	let timer4	= 9;
	let CenX	= GetStgFrameWidth/2.0;
	let MinY	= 0;

	LoadTexture(imgtimer);

	loop(4) {
		ObjPrim_SetTexture(id[i],imgtimer);
		Obj_SetRenderPriorityI(id[i],80);
		ObjPrim_SetPrimitiveType(id[i],PRIMITIVE_TRIANGLESTRIP);
		ObjPrim_SetVertexCount(id[i],4);
		ObjPrim_SetVertexPosition(id[i],0,-8.0,-16.0,0);
		ObjPrim_SetVertexPosition(id[i],1,-8.0, 16.0,0);
		ObjPrim_SetVertexPosition(id[i],2, 8.0,-16.0,0);
		ObjPrim_SetVertexPosition(id[i],3, 8.0, 16.0,0);
		i++;
	}

	ObjRender_SetScaleXYZ(id[0],1.0*TIME_SCALE,1.0*TIME_SCALE,1.00);
	ObjRender_SetScaleXYZ(id[1],1.0*TIME_SCALE,1.0*TIME_SCALE,1.00);
	ObjRender_SetScaleXYZ(id[2],0.6*TIME_SCALE,0.7*TIME_SCALE,1.00);
	ObjRender_SetScaleXYZ(id[3],0.6*TIME_SCALE,0.7*TIME_SCALE,1.00);
	ObjRender_SetPosition(id[0],CenX+177   ,MinY+17,0);
	ObjRender_SetPosition(id[1],CenX+177-12,MinY+17,0);
	ObjRender_SetPosition(id[2],CenX+177+17,MinY+20,0);
	ObjRender_SetPosition(id[3],CenX+177+10,MinY+20,0);

	while(!Obj_IsDeleted(Enemy)) {
		i = 0;
		ms -= 100/60;
		timer1 = truncate(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)%10);
		timer2 = truncate((ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)%100)/10);
		timer3 = truncate(ms%10);
		timer4 = truncate((ms%100)/10);

		if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)>99) { timer1 = 9; timer2 = 9; timer3 = 9; timer4 = 9; }
		if(ms < 100/60) { timer1 = 0; timer2 = 0; timer3 = 0; timer4 = 0; }

		if(timer2<1) { rgb =  [255,128,128];
			if(timer1<5) { rgb =  [255, 64, 64]; }
		}
		else { rgb =  [255,255,255]; }

		SetAreaCommonData("time","time1",timer1);
		SetAreaCommonData("time","time2",timer2);
		SetAreaCommonData("time","time3",timer3);
		SetAreaCommonData("time","time4",timer4);

		ObjPrim_SetVertexUVT(id[0],0,TIME_RECT_01[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],1,TIME_RECT_01[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[0],2,TIME_RECT_02[timer1],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[0],3,TIME_RECT_02[timer1],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],0,TIME_RECT_01[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],1,TIME_RECT_01[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[1],2,TIME_RECT_02[timer2],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[1],3,TIME_RECT_02[timer2],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[2],0,TIME_RECT_01[timer3],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[2],1,TIME_RECT_01[timer3],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[2],2,TIME_RECT_02[timer3],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[2],3,TIME_RECT_02[timer3],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[3],0,TIME_RECT_01[timer4],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[3],1,TIME_RECT_01[timer4],TIME_RECT_04);
		ObjPrim_SetVertexUVT(id[3],2,TIME_RECT_02[timer4],TIME_RECT_03);
		ObjPrim_SetVertexUVT(id[3],3,TIME_RECT_02[timer4],TIME_RECT_04);

		loop(4) {
			ObjPrim_SetVertexColor(id[i],0,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],1,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],2,rgb[0],rgb[1],rgb[2]);
			ObjPrim_SetVertexColor(id[i],3,rgb[0],rgb[1],rgb[2]);
			i++;
		}
		yield;
	}
	i=0;
	loop(4) {
		Obj_Delete(id[i]);
		i++;
	}
}

//-----------------------------------------------------------------------
// ■ 残り時間表示 [th13〜th14]
//-----------------------------------------------------------------------
function DrawTimerEx(type) {
	DrawTimer03(type);
}

//-----------------------------------------------------------------------
// ■ 残り時間表示 [th13〜th14] [遅延可能]
//-----------------------------------------------------------------------
task DrawTimerEx2(type,delay) {
	DrawTimer03_Ex(type,delay)
}

//-----------------------------------------------------------------------
// ■ カウントダウン [th06〜th14]
//-----------------------------------------------------------------------
task CountDown(se1,se2) {

	let Enemy	= GetEnemyBossObjectID[0];

	LoadSound(se1);
	LoadSound(se2);
	while(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)>9) { yield; }
	while(!Obj_IsDeleted(Enemy)) {
	    if(ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMER)>4) { PlaySE(se1); }
	    else { PlaySE(se2); }
	    loop(60) { yield; }
	}
}
