public static void SailsOpen() { Semih_Network value = ComponentManager <Semih_Network> .Value; List <Sail> allSails = Sail.AllSails; for (int i = 0; i < allSails.Count; i++) { Sail sail = allSails[i]; Message_NetworkBehaviour message_NetworkBehaviour = new Message_NetworkBehaviour((!sail.open) ? Messages.Sail_Open : Messages.Sail_Close, sail); if (Semih_Network.IsHost) { sail.Open(); value.RPC(message_NetworkBehaviour, Target.All, Steamworks.EP2PSend.k_EP2PSendReliableWithBuffering, 0); } else { value.SendP2P(value.HostID, message_NetworkBehaviour, Steamworks.EP2PSend.k_EP2PSendReliableWithBuffering, 0); } } }
public static void SailsOpen() { if (network == null) { network = ComponentManager <Semih_Network> .Value; } List <Sail> allSails = Sail.AllSails; for (int i = 0; i < allSails.Count; i++) { Sail sail = allSails[i]; Message_NetworkBehaviour message = new Message_NetworkBehaviour(Messages.Sail_Open, sail); if (Semih_Network.IsHost) { sail.Open(); network.RPC(message, Target.Other, EP2PSend.k_EP2PSendReliable, NetworkChannel.Channel_Game); continue; } network.SendP2P(network.HostID, message, EP2PSend.k_EP2PSendReliable, NetworkChannel.Channel_Game); } }