Пример #1
0
        public void Write(SKCanvas canvas, string text, int x, int y)
        {
            int pos = x;

            byte[] asciiBytes = Encoding.ASCII.GetBytes(text);
            foreach (byte b in asciiBytes)
            {
                if (b == 37)
                {
                    characters.StepAnim = 26;
                }
                else
                {
                    if (b < 58)
                    {
                        characters.StepAnim = b - 48 + 27;
                    }
                    else
                    {
                        characters.StepAnim = b - 65;
                    }
                }
                if (characters.StepAnim >= 0 && characters.StepAnim < 37)
                {
                    characters.Draw(canvas, pos, y);
                }
                pos += 8;
            }
        }
Пример #2
0
        } // Draw

        public void DrawOnlyShark(SKCanvas canvas, int scrollX)
        {
            foreach (OneMonster monster in monsters)
            {
                if (monster.Category == MonsterType.Shark)
                {
                    spriteShark.Draw(canvas, monster.X, monster.Y, scrollX);
                }
            }
        }
Пример #3
0
        // *********************************************************************

        public void Draw(SKCanvas canvas)
        {
            switch (state)
            {
            case WitchState.LeftWalk:
            case WitchState.LeftMount:
            case WitchState.LeftDescend:
            case WitchState.LeftFlySlow:
            case WitchState.LeftFlyMiddle:
            case WitchState.LeftFlyMax:
                toLeft.Draw(canvas, X, Y);
                break;

            case WitchState.RightWalk:
            case WitchState.RightMount:
            case WitchState.RightDescend:
            case WitchState.RightFlySlow:
            case WitchState.RightFlyMiddle:
            case WitchState.RightFlyMax:
                toRight.Draw(canvas, X, Y);
                break;

            case WitchState.MakePotion:
                spriteMakePotion.Draw(canvas, X, Y);
                break;

            case WitchState.Dying:
                spriteDying.Draw(canvas, X, Y);
                break;

            case WitchState.ExitingDoor:
                spriteExitingDoor.Draw(canvas, X, Y);
                break;

            case WitchState.EnterDoor:
                spriteEnterDoor.Draw(canvas, X, Y);
                break;
            }
        }
Пример #4
0
        // *********************************************************************

        /// <summary>
        /// Draw the specified canvas and scrollX.
        /// </summary>
        /// <param name="canvas">Canvas.</param>
        /// <param name="scrollX">Scroll x.</param>
        public void Draw(SKCanvas canvas, int scrollX)
        {
            foreach (OneMonster monster in monsters)
            {
                switch (monster.Category)
                {
                case MonsterType.Bat_1:
                    spritesBat1[monster.AnimationStep].Draw(canvas, monster.X, monster.Y, scrollX);
                    break;

                case MonsterType.Bat_2:
                    spritesBat2[monster.AnimationStep].Draw(canvas, monster.X, monster.Y, scrollX);
                    break;

                case MonsterType.Ghost:
                    spritesGhost[monster.AnimationStep].Draw(canvas, monster.X, monster.Y, scrollX);
                    break;

                case MonsterType.Seagull:
                    spritesSeagull[monster.AnimationStep].Draw(canvas, monster.X, monster.Y, scrollX);
                    break;

                case MonsterType.Fireball:
                    spritesFireball[monster.AnimationStep].Draw(canvas, monster.X, monster.Y, scrollX);
                    break;

                case MonsterType.Skull:
                    spritesSkull[monster.AnimationStep].Draw(canvas, monster.X, monster.Y, scrollX);
                    break;

                case MonsterType.Bones:
                    spritesBones[monster.AnimationStep].Draw(canvas, monster.X, monster.Y, scrollX);
                    break;

                case MonsterType.Ribcage:
                    spritesRibcage[monster.AnimationStep].Draw(canvas, monster.X, monster.Y, scrollX);
                    break;

                case MonsterType.Snapper:
                    spritesSnapper[monster.AnimationStep].Draw(canvas, monster.X, monster.Y, scrollX);
                    break;

                case MonsterType.Mandragora:
                    spritesMandragora[monster.AnimationStep].Draw(canvas, monster.X, monster.Y, scrollX);
                    break;

                case MonsterType.Pumpkin:
                    spritesPumpkin[monster.AnimationStep].Draw(canvas, monster.X, monster.Y, scrollX);
                    break;

                case MonsterType.PumpKing:
                    spritesPumpKing[monster.AnimationStep].Draw(canvas, monster.X, monster.Y, scrollX);
                    break;
                }
            }

            foreach (var kvp in explodes)
            {
                spriteExplode.StepAnim = kvp.Value.Step;
                spriteExplode.Draw(canvas, kvp.Value.X, kvp.Value.Y, scrollX, kvp.Value.paintColor);
            }
        } // Draw