private void OnReady() { //Debug.Log("Spawning Object1"); //System.Random rnd = new System.Random(); System.Random rnd = new System.Random(System.Guid.NewGuid().GetHashCode()); int index = rnd.Next(0, spawnPoints.Count); if (connectionToClient.isReady) { if (spawnPointIndexs.Contains(index)) { for (int i = 0; i < spawnPoints.Count; i++) { if (!spawnPointIndexs.Contains(i) && CheckSpawnPoint(index)) { index = i; break; } } } myPlayer = Instantiate(playerUnit, spawnPoints[index].position, spawnPoints[index].rotation); NetworkServer.SpawnWithClientAuthority(myPlayer, connectionToClient); //CmdSpawnLocalUI(); } }
public void AddAccessList(List <Access> accessToBeAdded) { for (int i = 0; i < accessToBeAdded.Count; i++) { if (!accessSyncList.Contains((int)accessToBeAdded[i])) { accessSyncList.Add((int)accessToBeAdded[i]); } } }
public void UpdateVoteResult(int index, int votenum) { if (isServer) { vote[index] = votenum; } if (WhoTurn > 5 && !vote.Contains(6)) { var picked = 6; var templist = new List <int>(); var count = 0; for (int idx = 0; idx < 9; idx++) { templist = vote.FindAll(x => x == idx); if (count < templist.Count) { count = templist.Count; picked = idx; } } if (picked < 6) { RpcVoteResult(picked); if (isServer) { RpcLog($"\'<color=#{ColorUtility.ToHtmlStringRGBA(color[ColorDistribution[picked]])}>{playerNameList[picked]}</color>\'님이 외계인으로 의심받아 40% 자원 패널티를 입었습니다."); } //LM.CmdOnLogReceivedEvent($"\'<color=#{ColorUtility.ToHtmlStringRGBA(color[ColorDistribution[picked]])}>{playerNameList[picked]}</color>\'님이 외계인으로 의심받아 n% 자원 패널티를 입었습니다."); } else { if (isServer) { RpcLog($"외계인으로 의심받은 사람이 없어 자원 패널티를 아무도 받지 않았습니다."); } } //LM.CmdOnLogReceivedEvent($"외계인으로 의심받은 사람이 없어 자원 패널티를 아무도 받지 않았습니다."); for (int i = 0; i < 6; i++) { vote[i] = 6; //////테스트//// //vote[i] = 5; ///// } //vote[0] = 6; GotoNextTurn.Invoke(); //TurnEnded = true; } }
public bool canBuild(int type) { bool b = false; if (allowedTypes.Count == 0) { b = true; } else if (allowedTypes.Contains(type)) { b = true; } return(b); }
public void DistributionTurnOrder() { for (int i = 0; i < 6; i++) { var random_num = Random.Range(0, 6); if (TurnOrderDistribution.Contains(random_num)) { i--; } else { TurnOrderDistribution[i] = random_num; } } }
void OnActiveChg(int num) { numActive = num; if (!isServer) { return; } foreach (NetPlayerController player in GameManager.players) { if (activePlayers.Contains(player.index)) { player.setActive(); } else { player.unSetActive(); } } }
#pragma warning disable 618 public void DisplayRelationShipView(SyncListInt oldStates, RelationshipState newState) #pragma warning restore 618 { Show(); DisableAllViews(); ChangeRelationShipView.SetActive(true); foreach (Transform child in RelationShipListRoot) { Destroy(child.gameObject); } #pragma warning disable 618 var alreadySeenRelationships = new HashSet <(NetworkInstanceId, NetworkInstanceId)>(); #pragma warning restore 618 foreach (var player in GameManager.Instance.Players) { for (int i = 0; i < player.Diplomacy.PlayerRelationships.Count; i++) { var relationship = player.Diplomacy.PlayerRelationships[i]; if (oldStates.Contains((int)relationship.State) && !alreadySeenRelationships.Contains((relationship.PartnerId, player.netId))) { var partner = GameManager.Instance.GetPlayerOfId(relationship.PartnerId); alreadySeenRelationships.Add((player.netId, relationship.PartnerId)); string label = $"{relationship}: {player.ToString()} <-> {partner.ToString()}"; AddRelationShipRepresantation(label, () => { player.Diplomacy.CmdSetRelation(relationship.PartnerId, newState); #pragma warning disable 618 ClientScene.FindLocalObject(relationship.PartnerId).GetComponent <Diplomacy>().CmdSetRelation(player.netId, newState); #pragma warning restore 618 }); Player.LocalPlayer.MoveEventCardOnGraveyard(); } } } Player.LocalPlayer.PopulateRelationshipView = false; OnDone = OnClickDoneRelationships; }
/// <summary> /// Generates a person with a normal distribution of traits. /// </summary> protected virtual void generatePerson() { int[] array = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; // indices of all traits int[] managerArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; // indices of all restaurant manager traits int[] factoryArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; // indices of all factory manager traits array = scrambleArray(array); managerArray = scrambleArray(managerArray); factoryArray = scrambleArray(factoryArray); string[] names = System.IO.File.ReadAllLines(@"Assets\names\residentialSmallFirst.txt"); residentName = names [rng.Next(names.Length - 1)]; // choose random name from file for the resident traits.Add(array[0]); // assign traits from the scrambled array of traits traits.Add(array [1]); traits.Add(array [2]); bossTraits.Add(managerArray [0]); // assign manager traits bossTraits.Add(managerArray [1]); bossTraits.Add(managerArray [2]); factoryBossTraits.Add(factoryArray [0]); factoryBossTraits.Add(factoryArray [1]); factoryBossTraits.Add(factoryArray [2]); if (traits.Contains(2)) // 2 is the elderly trait. If they have it, use the old-looking portraits { int[] oldguys = { 4, 8, 13 }; portrait = oldguys [(int)Random.Range(0, oldguys.Length)]; } else // use a young-looking portrait { int[] youngGuys = { 0, 1, 2, 3, 5, 6, 7, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19 }; portrait = youngGuys[(int)Random.Range(0, youngGuys.Length)]; } }
/// <summary> /// Checks if this id card has the indicated access. /// </summary> /// <param name="access"></param> /// <returns></returns> public bool HasAccess(Access access) { return(accessSyncList.Contains((int)access)); }
public bool HasItemById(int id) { return(listOfItemsID.Contains(id)); }