106 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			106 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
|  | 
 | |||
|  | function sq_AddFunctionName(appendage) | |||
|  | { | |||
|  | 	appendage.sq_AddFunctionName("proc", "proc_appendage_creator_disturb") | |||
|  | 	appendage.sq_AddFunctionName("prepareDraw", "prepareDraw_appendage_creator_disturb") | |||
|  | 	appendage.sq_AddFunctionName("onStart", "onStart_appendage_creator_disturb") | |||
|  | 	appendage.sq_AddFunctionName("onEnd", "onEnd_appendage_creator_disturb") | |||
|  | 	appendage.sq_AddFunctionName("isEnd", "isEnd_appendage_creator_disturb") | |||
|  | } | |||
|  | 
 | |||
|  | 
 | |||
|  | function sq_AddEffect(appendage) | |||
|  | { | |||
|  | } | |||
|  | 
 | |||
|  | function proc_appendage_creator_disturb(appendage) | |||
|  | { | |||
|  | 	if (!appendage) | |||
|  | 	{ | |||
|  | 		return; | |||
|  | 	} | |||
|  | 	 | |||
|  | 	local cnt = appendage.sq_var.get_vector(I_REMAIN_COUNT); | |||
|  | 	local isCharge = appendage.sq_var.get_vector(l_CHARGE_ON); // 醱瞪 酝樯虽 羹觼 | |||
|  | 	 | |||
|  | 	// 醱瞪赅萄塭贼.. | |||
|  | 	if (isCharge) | |||
|  | 	{ | |||
|  | 		// 譆渠醱瞪榆击 椭横谛怃 醱瞪击 卫霾栖棻. | |||
|  | 		local time = appendage.getTimer().Get(); | |||
|  | 
 | |||
|  | 		appendage.sq_var.set_vector(I_CURRENT_CHARGE_TIME, time); | |||
|  | 		 | |||
|  | 		local maxCnt = appendage.sq_var.get_vector(I_MAX_COUNT); | |||
|  | 		local initRemainCnt = appendage.sq_var.get_vector(I_CHARGE_INIT_COUNT); | |||
|  | 		local maxChargeT = appendage.sq_var.get_vector(I_CHARGE_TIME); | |||
|  | 		local chargeTime = maxChargeT.tofloat() * ((maxCnt.tofloat() - initRemainCnt.tofloat()) / maxCnt.tofloat()); | |||
|  | 
 | |||
|  | 		//print(" disburb charge t:" + maxChargeT); | |||
|  | 		local currentCnt = sq_GetUniformVelocity(initRemainCnt, maxCnt, time, chargeTime.tointeger()); | |||
|  | 		appendage.sq_var.set_vector(I_REMAIN_COUNT, currentCnt); | |||
|  | 		 | |||
|  | 		// 棻 瓣锡棻贼 醱瞪赅萄 ?薯 | |||
|  | 		if (currentCnt >= maxCnt) | |||
|  | 		{ | |||
|  | 			appendage.sq_var.set_vector(l_CHARGE_ON, 0); | |||
|  | 			appendage.sq_var.set_vector(I_CHARGE_INIT_COUNT, 0); | |||
|  | 			appendage.sq_var.set_vector(I_CURRENT_CHARGE_TIME, 0); | |||
|  | 		} | |||
|  | 	} | |||
|  | } | |||
|  | 
 | |||
|  | 
 | |||
|  | function onStart_appendage_creator_disturb(appendage) | |||
|  | { | |||
|  | 	if(!appendage) { | |||
|  | 		return; | |||
|  | 	} | |||
|  | 	 | |||
|  | 	local obj = appendage.getParent();	 | |||
|  | 	 | |||
|  | 	local sq_var = appendage.sq_var; | |||
|  | 	sq_var.clear_timer_vector(); | |||
|  | 	sq_var.push_timer_vector(); | |||
|  | 	 | |||
|  | 	local t = sq_var.get_timer_vector(0); | |||
|  | 	 | |||
|  | 	if (t) | |||
|  | 	{ | |||
|  | 		local eventTerm = 10; | |||
|  | 		t.setParameter(eventTerm, -1); | |||
|  | 		t.resetInstant(0); | |||
|  | 	} | |||
|  | } | |||
|  | 
 | |||
|  | 
 | |||
|  | function prepareDraw_appendage_creator_disturb(appendage) | |||
|  | { | |||
|  | 	if(!appendage) { | |||
|  | 		return; | |||
|  | 	} | |||
|  | 	 | |||
|  | 	local obj = appendage.getParent();	 | |||
|  | } | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | function onEnd_appendage_creator_disturb(appendage) | |||
|  | { | |||
|  | 	if(!appendage) { | |||
|  | 		return; | |||
|  | 	} | |||
|  | 	 | |||
|  | 	local obj = appendage.getParent(); | |||
|  | } | |||
|  | 
 | |||
|  | 
 | |||
|  | function isEnd_appendage_creator_disturb(appendage) | |||
|  | { | |||
|  | 	if(!appendage) return false; | |||
|  | 	 | |||
|  | 	local T = appendage.getTimer().Get(); | |||
|  | 	 | |||
|  | 	return false; | |||
|  | } |