static void SetMatchId(NetworkMatchChecker target, Guid guid) { // set using reflection so bypass property FieldInfo field = typeof(NetworkMatchChecker).GetField("currentMatch", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(target, guid); }
void Awake() { networkMatchChecker = GetComponent <NetworkMatchChecker>(); string[] az = new string[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" }; playerName = az[Random.Range(0, az.Length)]; gameObject.name = playerName; }
public void Setup() { // todo use Substitute for interfaces instead of gameobjeccts for this test serverGO = new GameObject("Network Server", typeof(TestSocketFactory), typeof(NetworkServer), typeof(ServerObjectManager)); server = serverGO.GetComponent <NetworkServer>(); serverObjectManager = serverGO.GetComponent <ServerObjectManager>(); serverObjectManager.Server = server; character1 = new GameObject("TestCharacter1", typeof(NetworkIdentity), typeof(NetworkMatchChecker)); character2 = new GameObject("TestCharacter2", typeof(NetworkIdentity), typeof(NetworkMatchChecker)); character3 = new GameObject("TestCharacter3", typeof(NetworkIdentity)); character1.GetComponent <NetworkIdentity>().Server = server; character1.GetComponent <NetworkIdentity>().ServerObjectManager = serverObjectManager; character2.GetComponent <NetworkIdentity>().Server = server; character2.GetComponent <NetworkIdentity>().ServerObjectManager = serverObjectManager; character3.GetComponent <NetworkIdentity>().Server = server; character3.GetComponent <NetworkIdentity>().ServerObjectManager = serverObjectManager; player1MatchChecker = character1.GetComponent <NetworkMatchChecker>(); player2MatchChecker = character2.GetComponent <NetworkMatchChecker>(); player1Connection = CreatePlayer(character1); player2Connection = CreatePlayer(character2); player3Connection = CreatePlayer(character3); var g = GetMatchPlayersDictionary(); matchPlayers = g; }
public void Setup() { serverGO = new GameObject("Network Server", typeof(LoopbackTransport), typeof(NetworkServer), typeof(ServerObjectManager)); server = serverGO.GetComponent <NetworkServer>(); serverObjectManager = serverGO.GetComponent <ServerObjectManager>(); serverObjectManager.Server = server; player1 = new GameObject("TestPlayer1", typeof(NetworkIdentity), typeof(NetworkMatchChecker)); player2 = new GameObject("TestPlayer2", typeof(NetworkIdentity), typeof(NetworkMatchChecker)); player3 = new GameObject("TestPlayer3", typeof(NetworkIdentity)); player1.GetComponent <NetworkIdentity>().Server = server; player1.GetComponent <NetworkIdentity>().ServerObjectManager = serverObjectManager; player2.GetComponent <NetworkIdentity>().Server = server; player2.GetComponent <NetworkIdentity>().ServerObjectManager = serverObjectManager; player3.GetComponent <NetworkIdentity>().Server = server; player3.GetComponent <NetworkIdentity>().ServerObjectManager = serverObjectManager; player1MatchChecker = player1.GetComponent <NetworkMatchChecker>(); player2MatchChecker = player2.GetComponent <NetworkMatchChecker>(); player1Connection = CreateNetworkConnection(player1); player2Connection = CreateNetworkConnection(player2); player3Connection = CreateNetworkConnection(player3); Dictionary <Guid, HashSet <NetworkIdentity> > g = GetMatchPlayersDictionary(); matchPlayers = g; }
private void Start() { enemy = (GameObject)Resources.Load("Prefabs/Enemy"); networkMatchChecker = GetComponent <NetworkMatchChecker>(); enemies = new List <GameObject>(); currWave = 1; }
void Start() { if (isLocalPlayer) { localPlayer = this; } networkMatchChecker = GetComponent <NetworkMatchChecker>(); }
// On Start, set a singleton to the player, and get references to the network manager and network match checker void Start() { if (isLocalPlayer) { localP = this; } nmc = GetComponent <NetworkMatchChecker>(); nm = GameObject.Find("NetworkManager"); }
private void Start() { DontDestroyOnLoad(this.gameObject); networkMatchChecker = GetComponent <NetworkMatchChecker>(); if (isLocalPlayer) { string name = displayName; localPlayer = this; } }
private void Start() { networkMatchChecker = GetComponent <NetworkMatchChecker>(); if (isLocalPlayer) { localPlayer = this; } else { UILobby.instance.SpawnPlayerUIPrefab(this); } }
private void Awake() { networkMatchChecker = GetComponent <NetworkMatchChecker>(); if (!isServer) { allTails.Add(this); } if (isHead) { snake = GetComponent <Snake>(); isAttached = true; } }
private void Start() { if (isLocalPlayer) { Debug.Log("This is called"); localPlayer = this; playerName = PlayerPrefs.GetString(PlayerPrefsNameKey); name = playerName; Debug.Log(localPlayer); } else { LobbyUI.instance.SpawnPlayerPrefab(this); } networkMatchChecker = GetComponent <NetworkMatchChecker>(); }
public void Setup() { transportGO = new GameObject("transportGO"); Transport.activeTransport = transportGO.AddComponent <MemoryTransport>(); player1 = new GameObject("TestPlayer1", typeof(NetworkIdentity), typeof(NetworkMatchChecker)); player2 = new GameObject("TestPlayer2", typeof(NetworkIdentity), typeof(NetworkMatchChecker)); player3 = new GameObject("TestPlayer3", typeof(NetworkIdentity)); player1MatchChecker = player1.GetComponent <NetworkMatchChecker>(); player2MatchChecker = player2.GetComponent <NetworkMatchChecker>(); player1Connection = CreateNetworkConnection(player1); player2Connection = CreateNetworkConnection(player2); player3Connection = CreateNetworkConnection(player3); Dictionary <Guid, HashSet <NetworkIdentity> > g = GetMatchPlayersDictionary(); matchPlayers = g; }
private void OnTriggerEnter2D(Collider2D collider) { NetworkMatchChecker colMatchChecker = collider.GetComponent <NetworkMatchChecker>(); if (collider.gameObject.CompareTag("Player") && colMatchChecker.matchId == networkMatchChecker.matchId) { collider.GetComponent <PlayerController>().RpcDamagePlayer(damage); collider.GetComponent <AudioSync>().RpcPlaySound(1); } else if (collider.gameObject.CompareTag("Enemy") && colMatchChecker.matchId == networkMatchChecker.matchId) { collider.GetComponent <Enemy>().TakeDamage(damage); collider.GetComponent <AudioSync>().RpcPlaySound(1); } if (colMatchChecker == null || collider.GetComponent <NetworkMatchChecker>().matchId == networkMatchChecker.matchId) { GameObject explode = Instantiate(explosion, transform.position, Quaternion.identity); explode.GetComponent <NetworkMatchChecker>().matchId = networkMatchChecker.matchId; NetworkServer.Spawn(explode); Destroy(gameObject); } }
void Awake() { networkMatchChecker = GetComponent <NetworkMatchChecker>(); }
private void Awake() { networkMatchChecker = GetComponent <NetworkMatchChecker>(); DontDestroyOnLoad(gameObject); }
private void Start() { health = maxHealth; networkMatchChecker = GetComponent <NetworkMatchChecker>(); }
// Start is called before the first frame updatesss void Awake() { networkMatchChecker = GetComponent <NetworkMatchChecker>(); instance = this; }
private void Start() { networkMatchChecker = GetComponent <NetworkMatchChecker>(); }
public void Awake() { networkMatchChecker = GetComponent <NetworkMatchChecker>(); health = GetComponent <Health>(); }