[置顶] 【Unity3D游戏开发】How to queue a heartbeat to get faster when an enemy is near (二四)

IEnumerator heartbeat_function()
{ 
	heartbeatsound.play();

	delay = vector3.distance(player_position, slender_man_position); 

	//delay = delay / 2 to make it happen twice as much
	//delay = delay * 2 to make it happen half as much figure out a the right multiplier or divider to get the result you want.

	if(delay > MAX_SAFE_DELAY) { 
		delay = MAX_SAFE_DELAY 
	}

	yield WaitForSeconds(delay);
}

敌人靠近时,模拟玩家的心跳

你可能感兴趣的:(unity,heartbeat,心跳)