示例#1
0
        public override void OnRender(CompositionTargetBase target)
        {
            if (this.IsAlive)
            {
                //alien walking
                switch (this.Status)
                {
                case AlienStatus.Walk1:
                    //legs
                    target.DrawPixel(this.XCenter - 1, this.YCenter, Colors.Lime);
                    target.DrawPixel(this.XCenter + 1, this.YCenter, Colors.Lime);

                    //head
                    target.DrawPixel(this.XCenter, this.YCenter - 1, Colors.Red);
                    break;


                case AlienStatus.Walk2:
                    //leg(s)
                    target.DrawPixel(this.XCenter, this.YCenter, Colors.Lime);

                    //head
                    target.DrawPixel(this.XCenter, this.YCenter - 1, Colors.Red);
                    break;
                }
            }
            else
            {
                this.RenderDeath(target);
            }
        }
示例#2
0
 public void OnRender(CompositionTargetBase target)
 {
     if (this.IsActive)
     {
         target.DrawPixel(this.XCenter, this.YCenter, Colors.Red);
     }
 }
示例#3
0
        public void OnRender(CompositionTargetBase target)
        {
            int bricks;

            if ((bricks = this.BricksAlive) != 0)
            {
                for (int y = 0; y < BarrierHeight; y++)
                {
                    int yy = this.YTop + y;

                    for (int x = 0; x < BarrierWidth; x++)
                    {
                        if ((bricks & 1) != 0)
                        {
                            target.DrawPixel(
                                this.XLeft + x,
                                yy,
                                Colors.Lime);
                        }

                        bricks >>= 1;
                    }
                }
            }
        }
示例#4
0
        public void OnRender(CompositionTargetBase target)
        {
            switch (this.Status)
            {
            case SaucerStatus.Inactive:
                break;

            case SaucerStatus.Active:
                //cabin
                target.DrawPixel(this.XCenter, this.YCenter, Colors.Lime);
                target.DrawPixel(this.XCenter + 1, this.YCenter, Colors.Lime);

                //rockets
                int y      = this.YCenter + 1;
                int color1 = (this.XCenter & 1) != 0 ? Colors.Red : Colors.Yellow;
                int color2 = (this.XCenter & 1) == 0 ? Colors.Red : Colors.Yellow;

                target.DrawPixel(this.XCenter - 1, y, color1);
                target.DrawPixel(this.XCenter, y, color2);
                target.DrawPixel(this.XCenter + 1, y, color1);
                target.DrawPixel(this.XCenter + 2, y, color2);
                break;


            case SaucerStatus.ExplodeExpand:
            case SaucerStatus.ExplodeCollapse:
                target.DrawPixel(this.XCenter, this.YCenter, Colors.Red);
                target.DrawPixel(this.XCenter + 1, this.YCenter, Colors.Red);

                target.DrawPixel(this.XCenter - 1, this.YCenter - 1, Colors.Yellow);
                target.DrawPixel(this.XCenter - 1, this.YCenter + 1, Colors.Yellow);
                target.DrawPixel(this.XCenter + 1, this.YCenter - 1, Colors.Yellow);
                break;


            case SaucerStatus.ExplodeMax:
                target.DrawPixel(this.XCenter, this.YCenter, Colors.Red);
                target.DrawPixel(this.XCenter - 1, this.YCenter, Colors.Red);
                target.DrawPixel(this.XCenter, this.YCenter - 1, Colors.Red);
                target.DrawPixel(this.XCenter + 1, this.YCenter - 1, Colors.Red);

                target.DrawPixel(this.XCenter - 1, this.YCenter - 2, Colors.Yellow);
                target.DrawPixel(this.XCenter + 1, this.YCenter - 2, Colors.Yellow);
                target.DrawPixel(this.XCenter + 2, this.YCenter - 2, Colors.Yellow);
                target.DrawPixel(this.XCenter + 1, this.YCenter - 3, Colors.Yellow);
                target.DrawPixel(this.XCenter - 2, this.YCenter + 1, Colors.Yellow);
                target.DrawPixel(this.XCenter + 2, this.YCenter + 1, Colors.Yellow);
                break;
            }
        }
示例#5
0
        protected void RenderDeath(CompositionTargetBase target)
        {
            switch (this.Status)
            {
            case AlienStatus.ExplodeExpand:
            case AlienStatus.ExplodeCollapse:
                target.DrawPixel(this.XCenter, this.YCenter, Colors.Red);
                target.DrawPixel(this.XCenter + 1, this.YCenter, Colors.Red);

                target.DrawPixel(this.XCenter - 1, this.YCenter - 1, Colors.Yellow);
                target.DrawPixel(this.XCenter - 1, this.YCenter + 1, Colors.Yellow);
                target.DrawPixel(this.XCenter + 1, this.YCenter - 1, Colors.Yellow);
                break;


            case AlienStatus.ExplodeMax:
                target.DrawPixel(this.XCenter, this.YCenter, Colors.Red);
                target.DrawPixel(this.XCenter - 1, this.YCenter, Colors.Red);
                target.DrawPixel(this.XCenter, this.YCenter - 1, Colors.Red);
                target.DrawPixel(this.XCenter + 1, this.YCenter - 1, Colors.Red);

                target.DrawPixel(this.XCenter - 1, this.YCenter - 2, Colors.Yellow);
                target.DrawPixel(this.XCenter + 1, this.YCenter - 2, Colors.Yellow);
                target.DrawPixel(this.XCenter + 2, this.YCenter - 2, Colors.Yellow);
                target.DrawPixel(this.XCenter + 1, this.YCenter - 3, Colors.Yellow);
                target.DrawPixel(this.XCenter - 2, this.YCenter + 1, Colors.Yellow);
                target.DrawPixel(this.XCenter + 2, this.YCenter + 1, Colors.Yellow);
                break;
            }
        }
示例#6
0
        private static void TestPoints()
        {
            int x = _counter & 31;

            _composition.DrawPixel(x, 0, Colors.Red);
            _composition.DrawPixel(x, 2, Colors.Red);
            _composition.DrawPixel(x, 4, Colors.Red);
            _composition.DrawPixel(x, 6, Colors.Red);
            _composition.DrawPixel(x, 8, Colors.Red);
            _composition.DrawPixel(x, 10, Colors.Red);
            _composition.DrawPixel(x, 12, Colors.Red);
            _composition.DrawPixel(x, 14, Colors.Red);

            _composition.DrawPixel(31 - x, 1, Colors.Lime);
            _composition.DrawPixel(31 - x, 3, Colors.Lime);
            _composition.DrawPixel(31 - x, 5, Colors.Lime);
            _composition.DrawPixel(31 - x, 7, Colors.Lime);
            _composition.DrawPixel(31 - x, 9, Colors.Lime);
            _composition.DrawPixel(31 - x, 11, Colors.Lime);
            _composition.DrawPixel(31 - x, 13, Colors.Lime);
            _composition.DrawPixel(31 - x, 15, Colors.Lime);
        }
示例#7
0
        public void OnRender(CompositionTargetBase target)
        {
            switch (this.Status)
            {
            case ShipStatus.Alive:
                target.DrawPixel(this.XCenter, this.YCenter, Colors.Yellow);
                target.DrawPixel(this.XCenter, this.YCenter - 1, Colors.Yellow);
                target.DrawPixel(this.XCenter - 1, this.YCenter, Colors.Yellow);
                target.DrawPixel(this.XCenter + 1, this.YCenter, Colors.Yellow);
                break;


            case ShipStatus.ExplodeExpand:
            case ShipStatus.ExplodeCollapse:
                target.DrawPixel(this.XCenter, this.YCenter, Colors.Red);
                target.DrawPixel(this.XCenter + 1, this.YCenter, Colors.Red);

                target.DrawPixel(this.XCenter - 1, this.YCenter - 1, Colors.Yellow);
                target.DrawPixel(this.XCenter - 1, this.YCenter + 1, Colors.Yellow);
                target.DrawPixel(this.XCenter + 1, this.YCenter - 1, Colors.Yellow);
                break;


            case ShipStatus.ExplodeMax:
                target.DrawPixel(this.XCenter, this.YCenter, Colors.Red);
                target.DrawPixel(this.XCenter - 1, this.YCenter, Colors.Red);
                target.DrawPixel(this.XCenter, this.YCenter - 1, Colors.Red);
                target.DrawPixel(this.XCenter + 1, this.YCenter - 1, Colors.Red);

                target.DrawPixel(this.XCenter - 1, this.YCenter - 2, Colors.Yellow);
                target.DrawPixel(this.XCenter + 1, this.YCenter - 2, Colors.Yellow);
                target.DrawPixel(this.XCenter + 2, this.YCenter - 2, Colors.Yellow);
                target.DrawPixel(this.XCenter + 1, this.YCenter - 3, Colors.Yellow);
                target.DrawPixel(this.XCenter - 2, this.YCenter + 1, Colors.Yellow);
                target.DrawPixel(this.XCenter + 2, this.YCenter + 1, Colors.Yellow);
                break;
            }
        }