can't reproduce

This commit is contained in:
mischa 2023-07-31 16:21:55 +08:00
parent a9cbcf696e
commit 1f61f9544a

View File

@ -60,16 +60,25 @@ void CmdFire()
{
GameObject projectile = Instantiate(projectilePrefab, projectileMount.position, projectileMount.rotation);
NetworkServer.Spawn(projectile);
RpcOnFire();
// RpcOnFire(connectionToClient);
TargetDoMagic(connectionToClient, 42);
}
// this is called on the tank that fired for all observers
[ClientRpc]
void RpcOnFire()
[TargetRpc]
void RpcOnFire(NetworkConnectionToClient conn)
{
Debug.Log($"RpcOnFire with conn={conn}");
animator.SetTrigger("Shoot");
}
[TargetRpc]
public void TargetDoMagic(NetworkConnectionToClient target, int damage)
{
// This will appear on the opponent's client, not the attacking player's
Debug.Log($"Magic Damage = {damage}");
}
[ServerCallback]
void OnTriggerEnter(Collider other)
{