PUN Classic (v1), PUN 2, Bolt는 휴업 모드입니다. Unity2022에 대해서는 PUN 2에서 서포트하지만, 신기능의 추가는 없습니다. 현재 이용중인 고객님의 PUN 및 Bolt 프로젝트는 중단되지 않고, 퍼포먼스나 성능이 떨어지는 일도 없습니다.
앞으로의 새로운 프로젝트에는 Photon Fusion 또는 Quantum을 사용해 주십시오.
IPriorityCalculator
IPriorityCalculator
lets you set the priority for state replication and entity events. For games with a big map with lots going on, you will not be able to fit bytes for every state and entity event you want to send. Return zero for nothing to be sent.
C#
public class EnemyController : Bolt.EntityEventListener<IEnemyTest>, Bolt.IPriorityCalculator
{
/**
* Calculates the Priority of a State update
* be sent into a package
* @param connection Target player connection
* @param skipped Total times the data was skipped
* on the packing process
* @return The priority number
*/
public float CalculateStatePriority(BoltConnection connection, int skipped)
{
// default implementation
// return skipped;
// returns priority based off
// of distance to connection's player
return 1000 - myDistanceTo(connection) + skipped;
}
/**
* Calculates the Priority of a Event
* be sent into a package
* @param connection Target player connection
* @param evnt The event to be sent
* @return The priority number
*/
public float CalculateEventPriority(BoltConnection connection, Bolt.Event evnt)
{
// this enemy has entity events for sounds, so this will
// always be low priority but will be higher priority than
// other sounds based on distance to connection's player
// myDistance has a maximum of 1000 in this example
return (1-(myDistanceTo(connection) / 1000f));
}
}