void GetTarget() { int n = 0; GameObject[] go; System.Collections.Generic.List <UserInfoClass> uList = new System.Collections.Generic.List <UserInfoClass> (); foreach (UserInfoClass a in GlobalInfo.userInfoList) { if (a.playerViewID.Equals(networkView.viewID)) { team = a.team; } } foreach (UserInfoClass a in GlobalInfo.userInfoList) { if (a.team != team && !a.destroyed) { uList.Add(a); } } n = Random.Range(1, uList.Count); go = GameObject.FindGameObjectsWithTag("PlayerTank"); foreach (GameObject a in go) { if (a.networkView.viewID.Equals(uList[n - 1].playerViewID)) { target = a.transform; break; } } }
public void ViewMinimap(TeamKind kind) { List <string> layers = new List <string>(); switch (kind) { case TeamKind.Both: layers.Add("Default"); layers.Add("TransparentFX"); layers.Add("Ignore Raycast"); layers.Add("Water"); layers.Add("TeamA"); layers.Add("TeamB"); layers.Add("Both"); break; case TeamKind.TeamA: layers.Add("Default"); layers.Add("TransparentFX"); layers.Add("Ignore Raycast"); layers.Add("Water"); layers.Add("TeamA"); layers.Add("Both"); break; case TeamKind.TeamB: layers.Add("Default"); layers.Add("TransparentFX"); layers.Add("Ignore Raycast"); layers.Add("Water"); layers.Add("TeamB"); layers.Add("Both"); break; default: layers.Add("Default"); layers.Add("TransparentFX"); layers.Add("Ignore Raycast"); layers.Add("Water"); layers.Add("Both"); break; } GameObject.Find("Minimap").GetComponent <Camera>().cullingMask = LayerMask.GetMask(layers.ToArray()); }