Assets/Deps/emotitron/NST Example/Scripts/Weapon.cs
/// <summary>
/// OnCustomMsgSndEvent fires on the originating client when a custom event is sent. The position and rotation information will contain the same
/// lossy rounding errors/ranges that are being sent to the network. Useful for ensuring that your local events use the exact same pos/rot data
/// the server and clients will be using (such as projectile vectors).
/// </summary>
/// <param name="rootPos">Lossy position after compression - exactly what is sent.</param>
/// <param name="rotations">Lossy rotation after compression - exactly what is sent.</param>
OnCustomMsgSndEvent fires on the originating client when a custom event is sent. The position and rotation information will contain the same
lossy rounding errors/ranges that are being sent to the network. Useful for ensuring that your local events use the exact same pos/rot data
the server and clients will be using (such as projectile vectors).
OnCustomMsgSndEvent fires on the originating client when a custom event is sent . The position and rotation information will contain the same lossy rounding errors / ranges that are being sent to the network . Useful for ensuring that your local events use the exact same pos / rot data the server and clients will be using ( such as projectile vectors ) .
private static void OnCustomMsgSnd(NetworkConnection ownerConn, byte[] bytearray, NetworkSyncTransform nst, Vector3 rootPos, List<GenericX> positions, List<GenericX> rotations)
	{
		Weapon wpn = nst.GetComponent<Weapon>();
		PlayerFireCustomMsg weaponFireMsg = bytearray.DeserializeToStruct<PlayerFireCustomMsg>();
		if (weaponFireMsg.weaponId == (byte)WeaponType.Bullet)
			wpn.FireBullet(rootPos, rotations[0], weaponFireMsg);
		else if (weaponFireMsg.weaponId == (byte)WeaponType.Mine)
			wpn.FireMine(wpn.turret.transform.position, rotations[1], weaponFireMsg);
	}
private static void OnCustomMsgSnd ( NetworkConnection ownerConn , byte [ ] bytearray , NetworkSyncTransform nst , Vector3 rootPos , List < GenericX > positions , List < GenericX > rotations ) { Weapon wpn = nst . GetComponent < Weapon > ( ) ; PlayerFireCustomMsg weaponFireMsg = bytearray . DeserializeToStruct < PlayerFireCustomMsg > ( ) ; if ( weaponFireMsg . weaponId == ( byte ) WeaponType . Bullet ) wpn . FireBullet ( rootPos , rotations [ 0 ] , weaponFireMsg ) ; else if ( weaponFireMsg . weaponId == ( byte ) WeaponType . Mine ) wpn . FireMine ( wpn . turret . transform . position , rotations [ 1 ] , weaponFireMsg ) ; }
OnCustomMsgSndEvent fires on the originating client when a custom event is sent.
OnCustomMsgSndEvent fires on the originating client when a custom event is sent .
ownerConn
NetworkConnection
bytearray
byte[]
nst
NetworkSyncTransform
rootPos
Vector3
Lossy position after compression - exactly what is sent.
Lossy position after compression - exactly what is sent .
positions
List<GenericX>
rotations
List<GenericX>
Lossy rotation after compression - exactly what is sent.
Lossy rotation after compression - exactly what is sent .