private void CreatePanelPlayers() { var holder = _popupPlayers.GetComponentsInChildren <Transform>().SearchChild("PopupPlayers"); var holderPlayers = holder.gameObject; //найдем панель под иконки игроков //---------------------------- _arrayPlayers = _objectStorage.GetPollObjects(ObjectTypeEnum.PrefabIconPlayer, 4); var players = _objectStorage.GetDictionaryCards(SubTypeCard.GameClass); var playersCards = new List <ICard>(players.Values); var count = 0; foreach (var obj in _arrayPlayers) { var gameclass = playersCards[count].GetDataCard().GameClass; var points = _dictionaryPoints[gameclass]; _configurateManager.Configurate(obj, holderPlayers, true, points[0], points[1], points[2], points[3]); var componentObj = obj.GetComponent <ActionsWithCardGameClass>(); componentObj.СhangeCardType(playersCards[count]); var icon = obj.GetComponentsInChildren <Transform>().SearchChild("Icon"); icon.GetComponent <Image>().sprite = componentObj.CardGame.GetDataCard().Art; componentObj.SetDependecies(_publisher); if (gameclass == GameClass.Red) { componentObj.SetSelected(); } var rect = obj.GetComponent <RectTransform>(); obj.GetComponent <BoxCollider2D>().SetSizeBox2D(rect, 10f, 10f); _publisher.AddSubscriber(componentObj); _publisher.Publish(null, new CustomEventArgs(GameEventName.SpawnPlayer, obj)); count++; } }
private void InitDictPlayers() { var cardsPlayers = _objectStorage.GetDictionaryCards(SubTypeCard.GameClass); foreach (var card in cardsPlayers) { _cardsPlayers.Add(card.Value.GetDataCard().GameClass, card.Value); } foreach (var player in _cardsPlayers) { var gameclass = player.Value.GetDataCard().GameClass; var attribute = player.Value.GetDataCard().Attribute; var hp = attribute[0]; var mp = attribute[1]; _curAndMaxHpPlayers[gameclass] = new List <float>() { hp.value, hp.value }; _curAndMaxMpPlayers[gameclass] = new List <float>() { mp.value, mp.value }; } InitBarsPlayers(); }