コード例 #1
0
ファイル: LevelCreator.cs プロジェクト: dweinberg/Half-Caked
        private static Level CreateLevel0()
        {
            Level lvl = new Level();

            lvl.Gravity = 9.80f;
            lvl.InitialPosition = new Vector2(0, -500);

            lvl.AssetName = "Level0";
            lvl.LevelIdentifier = 0;

            lvl.Tiles.Add(new Tile(new Rectangle(778, 0, 186, 281), Surface.Absorbs));
            lvl.Tiles.Add(new Tile(new Rectangle(964, 0, 420, 195), Surface.Normal));

            lvl.Tiles.Add(new Tile(new Rectangle(0, 473, 301, 151), Surface.Absorbs));
            lvl.Tiles.Add(new Tile(new Rectangle(301, 473, 411, 151), Surface.Normal));
            lvl.Tiles.Add(new Tile(new Rectangle(711, 473, 569, 151), Surface.Amplifies));

            lvl.Tiles.Add(new Tile(new Rectangle(0, 1500 - 364, 216, 364), Surface.Absorbs));
            lvl.Tiles.Add(new Tile(new Rectangle(216, 1500 - 364, 240, 364), Surface.Normal));
            lvl.Tiles.Add(new Tile(new Rectangle(456, 1500 - 364, 216, 364), Surface.Absorbs));
            lvl.Tiles.Add(new Tile(new Rectangle(672, 1500 - 364, 159, 364), Surface.Normal));
            lvl.Tiles.Add(new Tile(new Rectangle(0, 966, 216, 170), Surface.Normal));
            lvl.Tiles.Add(new Tile(new Rectangle(456, 966, 215, 170), Surface.Normal));

            lvl.Tiles.Add(new Tile(new Rectangle(936, 1500 - 421, 485, 421), Surface.Reflects));

            lvl.Tiles.Add(new Tile(new Rectangle(1718, 915, 282, 585), Surface.Absorbs));

            lvl.Checkpoints.Add(new Checkpoint(270, 1136 - 134, 0, 0, 4));
            lvl.Checkpoints.Add(new Checkpoint(680, 1136 - 134, 680, 1024, 1));
            lvl.Checkpoints.Add(new Checkpoint(1180, 1079 - 134, 1180, 1500, 1));
            lvl.Checkpoints.Add(new Checkpoint(1165, 473 - 134, 1275, 473, 2));
            lvl.Checkpoints.Add(new Checkpoint(75, 473 - 134, 100, 473, 2));

            Switch switch1 = new Switch(System.Guid.NewGuid(), new Vector2(1980, 815), Switch.SwitchState.Active);
            switch1.Actions.Add(new KeyValuePair<Guid, int>(Character.CharacterGuid, (int)Switch.SwitchState.Pressed));
            lvl.Obstacles.Add(switch1);

            Platform pf1 = new Platform(System.Guid.NewGuid(), new List<Vector2>() { new Vector2(1435, 1078), new Vector2(1607, 1078), new Vector2(1607, 473), new Vector2(1286, 473) }, 50, Platform.PlatformState.Forward);
            pf1.Actions.Add(new KeyValuePair<Guid, int>(switch1.Guid, (int)Platform.PlatformState.Startionary));
            lvl.Obstacles.Add(pf1);

            Door d1 = new Door(System.Guid.NewGuid(), new Vector2(778, 282), Door.DoorState.Stationary);
            d1.Actions.Add(new KeyValuePair<Guid, int>(switch1.Guid, (int)Door.DoorState.Opening));
            lvl.Obstacles.Add(d1);

            Enemy e1 = new Enemy(new Vector2(370, 472), 300);
            lvl.Actors.Add(e1);

            //Boundaries
            lvl.Tiles.Add(new Tile(new Rectangle(0, 1500 - 2, 2000, 2), Surface.Death));
            lvl.Tiles.Add(new Tile(new Rectangle(0, 0, 1500, 2), Surface.Absorbs));
            lvl.Tiles.Add(new Tile(new Rectangle(0, 0, 2, 2000), Surface.Absorbs));
            lvl.Tiles.Add(new Tile(new Rectangle(2000 - 2, 0, 2, 1500), Surface.Absorbs));

            return lvl;
        }
コード例 #2
0
        public EnemyModel(Enemy enemy, Ellipse rangeFinder, DesignerItem item, Level level)
            : base(item, level)
        {
            IsCentered = true;
            Data = mEnemy = enemy;
            mRangeFinder = rangeFinder;

            if(!level.Actors.Contains(mEnemy))
                level.Actors.Add(mEnemy);

            X = (int)enemy.InitialPosition.X;
            Y = (int)enemy.InitialPosition.Y;
            Range = Range;
        }
コード例 #3
0
        public EnemyPropertiesWindow(Enemy enemy, DesignerCanvas canvas, DesignerItem item, Level level)
            : base()
        {
            InitializeComponent();
            item.PropertyWindow = this;

            Ellipse rangeFinder = new Ellipse();
            Canvas.SetZIndex(rangeFinder, -10);

            var fadedRed = System.Windows.Media.Color.FromArgb(0, 255, 0, 50);

            rangeFinder.Fill = new RadialGradientBrush(System.Windows.Media.Colors.Red, fadedRed);
            rangeFinder.Stroke = Brushes.Green;
            rangeFinder.IsHitTestVisible = false;

            canvas.Children.Add(rangeFinder);

            DataContext = new EnemyModel(enemy, rangeFinder, item, level);
        }
コード例 #4
0
        // Fifth Level
        private static Level CreateLevel4()
        {
            Level lvl = new Level();

            lvl.Gravity = 40f;
            lvl.InitialPosition = new Vector2(0, -500);

            lvl.AssetName = "Level4";
            lvl.LevelIdentifier = 4;

            lvl.Tiles.Add(new Tile(new Rectangle(778, 0, 186, 281), Surface.Absorbs));
            lvl.Tiles.Add(new Tile(new Rectangle(964, 0, 420, 195), Surface.Normal));

            lvl.Tiles.Add(new Tile(new Rectangle(0, 473, 301, 151), Surface.Absorbs));
            lvl.Tiles.Add(new Tile(new Rectangle(301, 473, 411, 151), Surface.Normal));
            lvl.Tiles.Add(new Tile(new Rectangle(711, 473, 569, 151), Surface.Amplifies));

            lvl.Tiles.Add(new Tile(new Rectangle(0, 1500 - 364, 216, 364), Surface.Absorbs));
            lvl.Tiles.Add(new Tile(new Rectangle(216, 1500 - 364, 240, 364), Surface.Normal));
            lvl.Tiles.Add(new Tile(new Rectangle(456, 1500 - 364, 216, 364), Surface.Absorbs));
            lvl.Tiles.Add(new Tile(new Rectangle(672, 1500 - 364, 159, 364), Surface.Normal));
            lvl.Tiles.Add(new Tile(new Rectangle(0, 966, 216, 170), Surface.Normal));
            lvl.Tiles.Add(new Tile(new Rectangle(456, 966, 215, 170), Surface.Normal));

            lvl.Tiles.Add(new Tile(new Rectangle(936, 1500 - 421, 485, 421), Surface.Reflects));

            lvl.Tiles.Add(new Tile(new Rectangle(1718, 915, 282, 585), Surface.Absorbs));

            lvl.Checkpoints.Add(new Checkpoint(270, 1136 - 134, 0, 0, 4, "Keep in mind, when a subject is traversing a portal, minor radioactive particles may cause damages and mutations to the subject's DNA. Test subjects are required to sign a wavier taking sole responsibility for all costs incurred by this unfortunate fact."));
            lvl.Checkpoints.Add(new Checkpoint(680, 1136 - 134, 680, 1024, 1, null));
            lvl.Checkpoints.Add(new Checkpoint(1180, 1079 - 134, 1180, 1500, 1, null));
            lvl.Checkpoints.Add(new Checkpoint(1165, 473 - 134, 1275, 473, 2, null));
            lvl.Checkpoints.Add(new Checkpoint(0, 473, 150, 473, 2, null));

            Switch switch1 = new Switch(System.Guid.NewGuid(), new Vector2(1980, 815), Switch.SwitchState.Enabled);
            switch1.Actions.Add(new KeyValuePair<Guid, int>(Character.CharacterGuid, (int)Switch.SwitchState.Pressed));
            lvl.Obstacles.Add(switch1);

            Platform pf1 = new Platform(System.Guid.NewGuid(), new List<Vector2>() { new Vector2(1435, 1078), new Vector2(1607, 1078), new Vector2(1607, 473), new Vector2(1286, 473) }, 50, Platform.PlatformState.Forward);
            pf1.Actions.Add(new KeyValuePair<Guid, int>(switch1.Guid, (int)Platform.PlatformState.Stationary));
            lvl.Obstacles.Add(pf1);

            Door d1 = new Door(System.Guid.NewGuid(), new Vector2(778, 282), Door.DoorState.Stationary);
            d1.Actions.Add(new KeyValuePair<Guid, int>(switch1.Guid, (int)Door.DoorState.Opening));
            lvl.Obstacles.Add(d1);

            Enemy e1 = new Enemy(new Vector2(370, 472), 300);
            lvl.Actors.Add(e1);

            //Boundaries
            lvl.Tiles.Add(new Tile(new Rectangle(0, 1500 - 2, 2000, 2), Surface.Death));
            lvl.Tiles.Add(new Tile(new Rectangle(0, 0, 1500, 2), Surface.Absorbs));
            lvl.Tiles.Add(new Tile(new Rectangle(0, 0, 2, 2000), Surface.Absorbs));
            lvl.Tiles.Add(new Tile(new Rectangle(2000 - 2, 0, 2, 1500), Surface.Absorbs));

            return lvl;
        }
コード例 #5
0
        // Fourth Level
        private static Level CreateLevel3()
        {
            Level lvl = new Level();

            lvl.Gravity = 40f;
            lvl.InitialPosition = new Vector2(0, 0);

            lvl.AssetName = "Level3";
            lvl.LevelIdentifier = 3;

            //Lower Normal Surfaces
            lvl.Tiles.Add(new Tile(new Rectangle(0, 923, 1033, 77), Surface.Normal));
            lvl.Tiles.Add(new Tile(new Rectangle(1033, 847, 159, 76), Surface.Normal));
            lvl.Tiles.Add(new Tile(new Rectangle(1192, 764, 102, 83), Surface.Normal));
            lvl.Tiles.Add(new Tile(new Rectangle(1294, 689, 106, 75), Surface.Normal));
            lvl.Tiles.Add(new Tile(new Rectangle(1400, 118, 100, 571), Surface.Normal));

            //Absorbing Surface
            lvl.Tiles.Add(new Tile(new Rectangle(0, 401, 1074, 152), Surface.Absorbs));

            //Ceiling
            lvl.Tiles.Add(new Tile(new Rectangle(0, 0, 1400, 118), Surface.Normal));

            lvl.Checkpoints.Add(new Checkpoint(50, 850, 0, 0, 4, "I am very impressed by your progress. The turrets you find in the next test are very valuable. If you cause damage to them, you will be liable for all repair and replacement costs."));
            lvl.Checkpoints.Add(new Checkpoint(0, 401, 165, 415, 2, null));

            //Boundaries
            lvl.Tiles.Add(new Tile(new Rectangle(0, 1000 - 2, 1500, 2), Surface.Absorbs));
            lvl.Tiles.Add(new Tile(new Rectangle(0, 0, 1500, 2), Surface.Absorbs));
            lvl.Tiles.Add(new Tile(new Rectangle(0, 0, 2, 1000), Surface.Absorbs));
            lvl.Tiles.Add(new Tile(new Rectangle(1500 - 2, 0, 2, 1000), Surface.Absorbs));

            //Lower Enemies
            Enemy e1 = new Enemy(new Vector2(550, 922), 300);
            lvl.Actors.Add(e1);
            Enemy e2 = new Enemy(new Vector2(650, 922), 300);
            lvl.Actors.Add(e2);

            //Upper Enemies
            Enemy e3 = new Enemy(new Vector2(550, 400), 300);
            lvl.Actors.Add(e3);
            Enemy e4 = new Enemy(new Vector2(650, 400), 300);
            lvl.Actors.Add(e4);

            return lvl;
        }
コード例 #6
0
 EventHandler<BoolEventArgs> NewEnemyHandler(DesignerItem item)
 {
     Enemy en = new Enemy();
     EnemyPropertiesWindow epw = new EnemyPropertiesWindow(en, this, item, Level);
     this.Children.Add(epw);
     return epw.SelectionHandler;
 }
コード例 #7
0
        private void AddEnemy(Enemy enemy)
        {
            DesignerItem item = CreateDesignerImage(mEnemyImage);

            PropertiesWindow pw = new EnemyPropertiesWindow(enemy, MyDesignerCanvas, item, Level);
            MyDesignerCanvas.Children.Add(pw);

            item.OnSelected += pw.SelectionHandler;
            item.IsSelected = true;
        }