public void Bancrupt() { int profit = GetComponent <Property>().SellAllCards(); Money money = GetComponent <Money>(); money.Transaction(-profit); // деньги за продажу всех территорий if ((targetCard != null) && !(targetCard.owner == null)) { targetCard.owner.GetComponent <Money>().Transaction(-money.MoneyAmount); } money.Transaction(money.MoneyAmount); // деньги до нуля // перейти к следущему игроку hud.HideAll(); turn.player = nextPlayer; hud.ShowRoll(); // turn.RemovePlayer(this); }
void Start() { Assembly thisAssembly = Assembly.GetExecutingAssembly(); StringBuilder OutputText; OutputText = new StringBuilder(); print("Start information"); foreach (Type t in thisAssembly.GetTypes()) { OutputText.AppendLine("\n FIELDS FOR:" + t.FullName + "\r\n"); MemberInfo[] Members = t.GetMembers(); FieldInfo[] fields = t.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); PropertyInfo[] properties = t.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly); MethodInfo[] methods = t.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly); OutputText.Append(fields.Length); foreach (FieldInfo NextMember in fields) { if (NextMember.IsPublic) { OutputText.AppendLine("\n\t" + NextMember.Name + "\tpublic\t" + NextMember.FieldType); } else { OutputText.AppendLine("\n\t" + NextMember.Name + "\tprivate\t" + NextMember.FieldType); } } OutputText.Append("\nPROPERTIES FOR " + t.FullName + "\r\n"); foreach (PropertyInfo NextMember in properties) { OutputText.AppendLine("\n\t" + NextMember.Name + "\tpublic\t" + NextMember.PropertyType + "\tget/set"); } OutputText.Append("\n METHODS FOR " + t.FullName + "\r\n"); foreach (MethodInfo NextMember in methods) { if (NextMember.IsPublic) { OutputText.AppendLine("\n\t" + NextMember.Name + "\tpublic\t" + NextMember.ReturnType + "\t" + GetParamName(NextMember)); } else { OutputText.AppendLine("\n\t" + NextMember.Name + "\tprivate\t" + NextMember.ReturnType + "\t" + GetParamName(NextMember)); } } } print(OutputText); using (FileStream fs = new FileStream(@"c:\Users\Nick\Desktop\info.txt", FileMode.Create )) { using (StreamWriter sw = new StreamWriter(fs)) { sw.WriteLine(OutputText); } } print("End information"); operations = GetComponent <Operations>(); players = new List <PlayerStuff>(); for (int i = 0; i < GameSettings.NumberOfPlayers; i++) { var newPlayer = GameObject.Instantiate(prefabPlayer); newPlayer.name = names[i]; newPlayer.GetComponent <PlayerStuff>().color = playerColors[i]; newPlayer.transform.SetParent(transform); var newPanelPlayer = GameObject.Instantiate(prefabPanelPlayer); var texts = newPanelPlayer.GetComponentsInChildren <Text>(); texts[0].text = newPlayer.name; texts[1].text = newPlayer.GetComponent <Money>().MoneyAmount.ToString(); newPanelPlayer.transform.SetParent(table.transform); newPanelPlayer.GetComponent <Image>().color = playerColors[i]; newPanelPlayer.GetComponent <TradeCenter>().player = newPlayer.GetComponent <PlayerStuff>(); newPlayer.GetComponent <PlayerStuff>().tablePlayer = newPanelPlayer; players.Add(newPlayer.GetComponent <PlayerStuff>()); } currentPlayerIndex = 0; player = players[currentPlayerIndex]; foreach (var item in players) { player = players[++currentPlayerIndex % players.Count]; item.nextPlayer = player; } hud.HideAll(); hud.ShowRoll(); }