Exemple #1
0
 public override void Evolve(Level level, Action action)
 {
     if (action == Action.UP || action == Action.DOWN)
         base.Evolve(level, this.action);
 }
Exemple #2
0
        public void Start()
        {
            level = new Level(9,3);
            level.actors.Add(new Player(0, 1));
            level.actors.Add(new Target(8, 1));

            int[,] actors = new int[,] { { 2, 0 }, {2,1},{ 3, 1 }, { 4, 1 }, { 5, 1 }, {6,1},{ 6, 0 }, { 4,2 } };
            for(int i = 0; i <= actors.GetUpperBound(0); i++)
                level.actors.Add(new Actor(actors[i,0],actors[i,1]));

            level.actors.Add(new Arrow(1, 0, Action.UP));
            GameActionEvent += level.ActionHandler;

            if (GameStartEvent != null) GameStartEvent(this, EventArgs.Empty);
        }
Exemple #3
0
 public virtual void Evolve(Level level, Action action)
 {
 }
Exemple #4
0
        public override void Evolve(Level level, Action action)
        {
            switch (action)
            {
                case Action.DOWN:
                    y--;
                    break;
                case Action.UP:
                    y++;
                    break;
                case Action.LEFT:
                    x--;
                    break;
                case Action.RIGHT:
                    x++;
                    break;
            }

            x = Math.Min(Math.Max(x, 0), level.Width-1);
            y = (y+level.Height) % level.Height;
            return;
        }
Exemple #5
0
 public void DrawBorder(Level level)
 {
     var border = new Rectangle();
     border.Width = WIDTH_PIXELS * level.Width;
     border.Height = HEIGHT_PIXELS * level.Height;
     border.Stroke = Brushes.Black;
     Canvas.SetTop(border, 0);
     Canvas.SetLeft(border, 0);
     canvas.Children.Add(border);
 }
Exemple #6
0
        public void Draw(Level level, Actor actor)
        {
            var actorshape = new Ellipse();
            actorshape.Height = HEIGHT_PIXELS * CIRCLE_PERCENTAGE;
            actorshape.Width = WIDTH_PIXELS * CIRCLE_PERCENTAGE;

            actorshape.Fill = ActorColor(actor);

            Canvas.SetTop(actorshape, HEIGHT_PIXELS * (0.5 * (1-CIRCLE_PERCENTAGE) + (level.Height -1- actor.y)));
            Canvas.SetLeft(actorshape, WIDTH_PIXELS * (0.5 * (1 - CIRCLE_PERCENTAGE) + actor.x));

            canvas.Children.Add(actorshape);
        }
Exemple #7
0
 public void Draw(Level level)
 {
     canvas.Children.Clear();
     DrawBorder(level);
     foreach (var actor in level.actors)
         Draw(level, actor);
 }