コード例 #1
0
        internal static void Reset()
        {
            _missions = new MissionInfo[5];
            for (int i = 0; i < 5; i++)
            {
                var missionInfo = new MissionInfo();
                missionInfo.MapWidth    = Math.Min(100 + 10 * i, 150);
                missionInfo.MapHeight   = Math.Min(100 + 10 * i, 150);
                missionInfo.Difficulty  = i + 1;
                missionInfo.Enemies     = i + 1;
                missionInfo.RewardScrap = (int)(Rand.Next(50, 70) * EngineConsts.REPAIR_COST * (1 + 0.5 * i));
                missionInfo.RewardPart  = PartFactory.BuildRandom();
                _missions[i]            = missionInfo;
            }

            Blueprint  = new PartHandler(PartFactory.BuildSmallCore());
            AvailCores = new List <CorePart>()
            {
                PartFactory.BuildSmallCore()
            };

            var l1 = PartFactory.BuildLeg();

            l1.Center = new Loc(-2, 0);
            var l2 = PartFactory.BuildLeg();

            l2.Center = new Loc(2, 0);

            var m1 = PartFactory.BuildSmallMissile(true);
            var m2 = PartFactory.BuildSmallMissile(false);

            AvailParts = new List <Part>()
            {
                m1, m2,
                l1, l2
            };
            NextMission = GenerateMission();

            Scrap      = 0;
            Difficulty = 0;
            Year       = Game.Rand.Next(2100, 2200);

            Hangar = new List <PartHandler>();
            CorePart core = Game.AvailCores[0];
            Part     w1   = Game.AvailParts[0];
            Part     w2   = Game.AvailParts[1];

            var ph = new PartHandler(core);

            for (int i = 0; i < Game.AvailParts.Count; i++)
            {
                ph.Add(Game.AvailParts[i]);
            }
            ph.WeaponGroup.Add(w1, 0);
            ph.WeaponGroup.Add(w2, 0);
            Hangar.Add(ph);
            MechIndex = 0;

            _dead = false;
        }
コード例 #2
0
        public static void NewMission(MissionInfo info)
        {
            MessagePanel.Clear();
            AnimationHandler.Clear();

            SetupLevel(info);
            StateHandler.PushState(NormalState.Instance);
        }
コード例 #3
0
        internal static void SetupLevel(MissionInfo info)
        {
            AnimationHandler.Clear();
            EventScheduler.Clear();

            MessagePanel.Add($"Mission Start");

            BaseGame.MapHandler = new MapHandler(info.MapWidth, info.MapHeight, info.Difficulty);
            var mapgen = new CityMapgen(BaseGame.MapHandler, info);

            BaseGame.MapHandler = mapgen.Generate();
            MapHandler.PlaceActors(info, Game.Rand);
            MapHandler.Refresh();
        }