public static void Spawn(Projectile prefab, Vector2 position, Vector2 direction) { if (prefab == null) { Debug.LogWarning("Tried to spawn a projectile with null prefab."); return; } if (direction == Vector2.zero) { Debug.LogWarning("Tried to spawn projectile with zero direction. Projectile will not be spawned to avoid player confusion."); return; } if (!NetworkServer.active) { return; } SpawnLocal(prefab, position, direction); ProjectileMessage m = new ProjectileMessage(); m.Direction = direction; m.Position = position; NetworkServer.SendToAll(m); }
private static void OnMessage(NetworkConnection c, ProjectileMessage m) { if (NetworkServer.active) { return; } //var prefab = ???; //SpawnLocal(prefab, m.Position, m.Direction); }