コード例 #1
0
        static MapInitSystem()
        {
            PlayerPrototypes = Resources.LoadAll <PlayerObject>("SO/Players")
                               .ToDictionary(po => Regex.Match(po.name,
                                                               "^([A-Z][a-z]+)") // Первая часть до следующей большой буквы
                                             .Value.ToLower());

            Skins = Resources.LoadAll <SkinInfo>("SO/Skins")
                    .ToDictionary(po => Regex.Match(po.name,
                                                    "^([A-Z][a-z]+)") // Первая часть до следующей большой буквы
                                  .Value);

            if (PlayerPrototypes.Any(p => p.Value == null))
            {
                throw new Exception($"В {nameof(MapInitSystem)} playerPrototype был null.");
            }

            if (Skins.Any(p => p.Value == null))
            {
                throw new Exception($"В {nameof(MapInitSystem)} skin был null.");
            }

            FlameCircle = Resources.Load <FlameCircleObject>("SO/BaseObjects/FlameCircle");
            if (FlameCircle == null)
            {
                throw new Exception($"В {nameof(MapInitSystem)} flameCircle был null.");
            }
            mapIntRadius = Mathf.CeilToInt(((CircleColliderInfo)FlameCircle.colliderInfo).radius);

            RandomAsteroid = Resources.Load <RandomObject>("SO/BaseObjects/RandomAsteroid");
            if (RandomAsteroid == null)
            {
                throw new Exception($"В {nameof(MapInitSystem)} asteroid был null.");
            }

            SpaceStation = Resources.Load <BaseWithHealthObject>("SO/BaseObjects/SpaceStation");
            if (SpaceStation == null)
            {
                throw new Exception($"В {nameof(MapInitSystem)} spaceStation был null.");
            }

            RandomBonus = Resources.Load <RandomObject>("SO/Bonuses/PickableObjects/RandomSmallBonus");
            if (RandomBonus == null)
            {
                throw new Exception($"В {nameof(MapInitSystem)} bonus был null.");
            }

            UpgradeBonus = Resources.Load <UpgradeBonusObject>("SO/Bonuses/PickableObjects/SmallUpgradeBonus");
            if (UpgradeBonus == null)
            {
                throw new Exception($"В {nameof(MapInitSystem)} upgrade bonus был null.");
            }

            Boss = Resources.Load <FighterObject>("SO/BaseObjects/ScarabBoss");
            if (Boss == null)
            {
                throw new Exception($"В {nameof(MapInitSystem)} boss был null.");
            }
        }
コード例 #2
0
 public ZoneInitSystem(Contexts contexts, FlameCircleObject zone)
 {
     gameContext = contexts.game;
     flameCircle = zone;
 }