private void InitTeam()
        {
            var     team    = teamService.Team(TEAM_TYPE);
            Vehicle vehicle = null;

            if (team != null)
            {
                vehicle = vehicleService.AvailableVehicle(team.vehicleId);
                hero1   = heroService.AvailableHero(team.hero1Id);
                hero2   = heroService.AvailableHero(team.hero2Id);
                hero3   = heroService.AvailableHero(team.hero3Id);
                hero4   = heroService.AvailableHero(team.hero4Id);
            }

            SelectHero1(hero1);
            SelectHero2(hero2);
            SelectHero3(hero3);
            SelectHero4(hero4);

            if (vehicle == null)
            {
                vehicle = vehicleService.AvailableVehicle();
            }
            vehicleAvatarPrefab = Instantiate(vehicleAvatarPrefab, vehicleCanvas);
            vehicleAvatarPrefab.SetVehicle(vehicle);
            vehicleAvatarPrefab.ActivateNextAvailableOnClick();

            CheckButton();
        }
        private void UpdateExpedition()
        {
            title.text       = expedition.name;
            description.text = expedition.description;
            vehicleAvatar.SetVehicle(vehicleService.Vehicle(expedition.vehicleId));
            hero1.SetHero(heroService.Hero(expedition.hero1Id));
            hero2.SetHero(heroService.Hero(expedition.hero2Id));
            hero3.SetHero(heroService.Hero(expedition.hero3Id));
            hero4.SetHero(heroService.Hero(expedition.hero4Id));

            lootItems.ForEach(item => Destroy(item.gameObject));
            lootItems.Clear();
            if (expedition.lootedItems?.IsEmpty() == false)
            {
                lootContainer.gameObject.SetActive(true);
                actionButton.gameObject.SetActive(false);
                expedition.lootedItems.ForEach(item =>
                {
                    if (item.type == LootedItemType.GEAR)
                    {
                        var gear = gearService.Gear(item.value);
                        gear.markedToBreakdown = forgeService.IsAutoBreakdown(gear);
                    }
                    var prefab = Instantiate(lootItemPrefab, lootContainer);
                    prefab.SetItem(item, lootContainer.rect.height);
                    lootItems.Add(prefab);
                });
            }
            else
            {
                lootContainer.gameObject.SetActive(false);
            }
        }
Exemplo n.º 3
0
        private void InitTeam()
        {
            var team = teamService.Team(missionRequest.type);

            var vehicle = vehicleService.AvailableVehicle(team?.vehicleId) ?? vehicleService.AvailableVehicle();

            vehicleAvatar.SetVehicle(vehicle);
            vehicleAvatar.ActivateNextAvailableOnClick(UpdateXpAndAsc);

            hero1.SetHero(heroService.AvailableHero(team?.hero1Id));
            hero2.SetHero(heroService.AvailableHero(team?.hero2Id));
            hero3.SetHero(heroService.AvailableHero(team?.hero3Id));
            hero4.SetHero(heroService.AvailableHero(team?.hero4Id));

            CheckButton();
        }
        private void UpdateMission()
        {
            title.text = $"{mapService.GetMapName(mission.mapId)} {mission.posX}x{mission.posY}";
            vehicleAvatar.SetVehicle(vehicleService.Vehicle(mission.vehicleId));
            hero1.SetHero(heroService.Hero(mission.hero1Id));
            hero2.SetHero(heroService.Hero(mission.hero2Id));
            hero3.SetHero(heroService.Hero(mission.hero3Id));
            hero4.SetHero(heroService.Hero(mission.hero4Id));

            var battleNumber = 1;

            mission.battles.ForEach(battle =>
            {
                var battleView = battleViews.ContainsKey(battle.battleId) ? battleViews[battle.battleId] : null;
                if (battleView == null)
                {
                    battleView = Instantiate(missionBattlePrefab, battlesCanvas);
                    battleViews[battle.battleId] = battleView;
                }
                battleView.SetBattle(battle, battleNumber);
                battleNumber++;
            });
        }