Пример #1
0
        public override void DrawFrame(SceneGame scene, Vector2 pos, PoseData poseData, Facing facing, Matrix transform, Color color, ColorMatrix colorMatrix)
        {
            var mirror = Microsoft.Xna.Framework.Graphics.SpriteEffects.None;

            int frameOffset = 0;

            switch (poseData.Pose)
            {
            case (CreaturePose.Stand):
                frameOffset = (int)Math.Round(poseData.Frame * AnimationSpeedStand);
                break;

            case (CreaturePose.Walk):
                frameOffset = (int)Math.Round(poseData.Frame * AnimationSpeedWalk);
                break;

            case (CreaturePose.Attack):
                frameOffset = (int)Math.Round(poseData.Frame * AnimationSpeedAttack);
                break;

            case (CreaturePose.Cast):
                frameOffset = (int)Math.Round(poseData.Frame * AnimationSpeedCast);
                break;
            }

            scene.PushSpriteBatch(shader: scene.Shader, shaderSetup: (matrix, projection) =>
            {
                scene.SetupColorMatrix(Color * colorMatrix, transform * matrix, projection);
            });
            scene.DrawSprite(Sprite, frameOffset, pos, mirror, color, 0);
            scene.PopSpriteBatch();
        }
Пример #2
0
        public override void Draw(SceneGame scene, DrawPass pass)
        {
            if (Sprite == null)
            {
                return;
            }

            if (ColorMatrix.HasValue)
            {
                scene.PushSpriteBatch(shaderSetup: (matrix, projection) =>
                {
                    scene.SetupColorMatrix(ColorMatrix.Value, matrix, projection);
                });
            }

            Vector2 nextPosition = Position;

            int i = 0;

            foreach (var trailPos in TrailPositions)
            {
                Vector2 currentPosition = Vector2.Lerp(trailPos, nextPosition, 0.5f);
                float   lerpSlide       = Util.ReverseLerp(Slide, 0.5f, 1.0f);
                Color   color           = Color.Lerp(Color, ColorEnd, (float)i / (TrailPositions.Count - 1));
                color = Color.Lerp(color, Color.TransparentBlack, (float)ColorLerp(0, 1, lerpSlide));
                scene.DrawSpriteExt(Sprite, SubImage, currentPosition - Sprite.Middle, Sprite.Middle, Angle, new Vector2(Scale), Mirror, color, 0);
                nextPosition = currentPosition;
                i++;
            }

            if (ColorMatrix.HasValue)
            {
                scene.PopSpriteBatch();
            }
        }
Пример #3
0
        public override void DrawFrame(SceneGame scene, Vector2 pos, PoseData poseData, Facing facing, Matrix transform, Color color, ColorMatrix colorMatrix)
        {
            SpriteReference abyssalTendril = SpriteLoader.Instance.AddSprite("content/abyssal_tendril_bush");

            var mirror = Microsoft.Xna.Framework.Graphics.SpriteEffects.None;

            bool tendrilDown     = IsTendrilDown(poseData.Pose);
            bool tendrilDownLast = IsTendrilDown(poseData.PoseLast);
            int  frameOffset     = 0;

            switch (poseData.Pose)
            {
            case (CreaturePose.Attack):
                frameOffset = 3 + (poseData.PoseFrame / 2) % 4;
                break;

            case (CreaturePose.Cast):
                frameOffset = 3 + (poseData.PoseFrame / 4) % 4;
                break;
            }

            if (tendrilDown != tendrilDownLast && poseData.PoseFrame < 15)
            {
                frameOffset = 1 + (poseData.PoseFrame / 10) % 2;
            }

            scene.PushSpriteBatch(shader: scene.Shader, shaderSetup: (matrix, projection) =>
            {
                scene.SetupColorMatrix(Color * colorMatrix, transform * matrix, projection);
            });
            scene.DrawSprite(abyssalTendril, frameOffset, pos - new Vector2(0, 16), mirror, color, 0);
            scene.PopSpriteBatch();
        }
Пример #4
0
        public override void DrawFrame(SceneGame scene, Vector2 pos, PoseData poseData, Facing facing, Matrix transform, Color color, ColorMatrix colorMatrix)
        {
            var mirror       = Microsoft.Xna.Framework.Graphics.SpriteEffects.None;
            int facingOffset = 0;

            switch (facing)
            {
            case (Facing.North):
                facingOffset = 2;
                break;

            case (Facing.East):
                facingOffset = 1;
                mirror       = Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipHorizontally;
                break;

            case (Facing.South):
                facingOffset = 0;
                break;

            case (Facing.West):
                facingOffset = 1;
                break;
            }

            scene.PushSpriteBatch(shader: scene.Shader, shaderSetup: (matrix, projection) =>
            {
                scene.SetupColorMatrix(Color * colorMatrix, transform * matrix, projection);
            });
            scene.DrawSprite(Sprite, facingOffset, pos, mirror, color, 0);
            scene.PopSpriteBatch();
        }
Пример #5
0
        public override void DrawFrame(SceneGame scene, Vector2 pos, PoseData poseData, Facing facing, Matrix transform, Color color, ColorMatrix colorMatrix)
        {
            var mirror       = GetMirror(facing);
            int facingOffset = GetFacingOffset(facing);
            int frameOffset  = GetFrameOffset(poseData);

            scene.PushSpriteBatch(shader: scene.Shader, shaderSetup: (matrix, projection) =>
            {
                scene.SetupColorMatrix(Color * colorMatrix, transform * matrix, projection);
            });
            scene.DrawSprite(Sprite, facingOffset + frameOffset, pos, mirror, color, 0);
            scene.PopSpriteBatch();
        }
Пример #6
0
        public override void DrawFrame(SceneGame scene, Vector2 pos, PoseData poseData, Facing facing, Matrix transform, Color color, ColorMatrix colorMatrix)
        {
            var mirror       = GetMirror(facing);
            int facingOffset = GetFacingOffset(facing);
            int frameOffset  = GetFrameOffset(poseData);

            scene.PushSpriteBatch(shader: scene.Shader, shaderSetup: (matrix, projection) =>
            {
                scene.SetupColorMatrix(Color * colorMatrix, transform * matrix, projection);
            });
            scene.DrawSprite(Sprite, facingOffset + frameOffset, pos, mirror, color, 0);
            scene.PopSpriteBatch();
            scene.PushSpriteBatch(shader: scene.Shader, shaderSetup: (matrix, projection) =>
            {
                scene.SetupColorMatrix(GlowColor, transform * matrix, projection);
            });
            if (Glow != null && GlowAmount != null)
            {
                scene.DrawSprite(Glow, facingOffset + frameOffset, pos, mirror, Microsoft.Xna.Framework.Color.White * GlowAmount(), 0);
            }
            scene.PopSpriteBatch();
        }
Пример #7
0
        public override void Draw(ICurio curio, SceneGame scene, DrawPass pass)
        {
            var spriteHelmet      = SpriteLoader.Instance.AddSprite("content/nemesis_helmet");
            var spriteBodyForward = SpriteLoader.Instance.AddSprite("content/nemesis_forward");
            var spriteBodyBack    = SpriteLoader.Instance.AddSprite("content/nemesis_back");
            var spriteWings       = SpriteLoader.Instance.AddSprite("content/nemesis_wings");
            var spriteParry       = SpriteLoader.Instance.AddSprite("content/nemesis_parry");

            var alive   = curio.GetBehavior <BehaviorAlive>();
            var nemesis = curio.GetBehavior <BehaviorNemesis>();

            if (alive.Armor > 0)
            {
                spriteBodyForward = SpriteLoader.Instance.AddSprite("content/nemesis_forward_armor");
                spriteBodyBack    = SpriteLoader.Instance.AddSprite("content/nemesis_back_armor");
            }

            var center    = curio.GetVisualPosition() + new Vector2(8, 8);
            var offset    = curio.GetOffset();
            var color     = curio.GetColor();
            var angleBody = curio.GetVisualAngle();

            scene.PushSpriteBatch(shader: scene.Shader, shaderSetup: (transform, projection) =>
            {
                scene.SetupColorMatrix(color);
            });
            SpriteReference spriteBody;
            float           headPos = MathHelper.Lerp(-4, 4, nemesis.ForwardBack);

            if (nemesis.ForwardBack > 0.5f)
            {
                spriteBody = spriteBodyForward;
            }
            else
            {
                spriteBody = spriteBodyBack;
            }
            scene.DrawSpriteExt(spriteBody, 0, center + offset - spriteBody.Middle, spriteBody.Middle, angleBody, new Vector2(1), SpriteEffects.None, Color.White, 0);
            scene.DrawSpriteExt(spriteHelmet, 0, center + offset + Util.AngleToVector(angleBody) * headPos - spriteHelmet.Middle, spriteHelmet.Middle, angleBody, new Vector2(1), SpriteEffects.None, Color.White, 0);
            if (nemesis.State == NemesisState.Parry)
            {
                scene.DrawSpriteExt(spriteParry, 0, center + offset - spriteParry.Middle, spriteParry.Middle, angleBody, new Vector2(1), SpriteEffects.None, Color.White, 0);
            }
            if (nemesis.ForwardBack > 0.5f && nemesis.WingsOpen > 0f)
            {
                Color wingColor = Color.Lerp(Color.Red, Color.Black, nemesis.WingsOpen);
                scene.DrawSpriteExt(spriteWings, 0, center + offset - spriteWings.Middle, spriteWings.Middle, angleBody, new Vector2(1), SpriteEffects.None, wingColor, 0);
            }

            scene.PopSpriteBatch();
        }
Пример #8
0
        public override void Draw(ICurio curio, SceneGame scene, DrawPass pass)
        {
            var center    = curio.GetVisualPosition() + new Vector2(8, 8);
            var offset    = curio.GetOffset();
            var color     = curio.GetColor();
            var angleBody = curio.GetVisualAngle();

            scene.PushSpriteBatch(shader: scene.Shader, shaderSetup: (transform, projection) =>
            {
                scene.SetupColorMatrix(color);
            });
            scene.DrawSpriteExt(Sprite, 0, center + offset - Sprite.Middle, Sprite.Middle, angleBody, new Vector2(1), SpriteEffects.None, Color.White, 0);
            scene.PopSpriteBatch();
        }
Пример #9
0
        public override void Draw(SceneGame scene, DrawPass pass)
        {
            scene.PushSpriteBatch(blendState: BlendState.Additive, shader: scene.Shader, shaderSetup: (matrix) =>
            {
                scene.SetupColorMatrix(ColorMatrix.TwoColor(new Color(0, 16, 0), new Color(16, 64, 255)), matrix);
            });
            var magicSparkle = SpriteLoader.Instance.AddSprite("content/magic_sparkle");
            int sparkles     = 3;

            for (int i = 0; i < sparkles; i++)
            {
                scene.DrawSprite(magicSparkle, (int)(Frame + (float)i / sparkles), Position - magicSparkle.Middle + Util.AngleToVector(MathHelper.TwoPi * (Frame / 10f + (float)i / sparkles)) * 4, SpriteEffects.None, 0);
            }
            scene.PopSpriteBatch();
        }
Пример #10
0
        public override void DrawFrame(SceneGame scene, Vector2 pos, PoseData poseData, Facing facing, Matrix transform, Color color, ColorMatrix colorMatrix)
        {
            SpriteReference abyssalTendril = SpriteLoader.Instance.AddSprite("content/abyssal_tendril");

            var    mirror      = Microsoft.Xna.Framework.Graphics.SpriteEffects.None;
            Random rand        = new Random(this.GetHashCode());
            int    wiggleFrame = poseData.PoseFrame + rand.Next(100);

            bool tendrilDown     = IsTendrilDown(poseData.Pose);
            bool tendrilDownLast = IsTendrilDown(poseData.PoseLast);
            int  frameOffset     = 0;
            bool invisible       = poseData.Pose == CreaturePose.Walk;

            switch (poseData.Pose)
            {
            case (CreaturePose.Stand):
                frameOffset = 2 + (wiggleFrame / 10) % 4;
                break;

            case (CreaturePose.Attack):
                frameOffset = 2 + (wiggleFrame / 2) % 4;
                break;

            default:
                frameOffset = 2 + (wiggleFrame / 4) % 4;
                break;
            }

            if (tendrilDown != tendrilDownLast && poseData.PoseFrame < 5 + rand.Next(20))
            {
                frameOffset = 0 + (wiggleFrame / 10) % 2;
                invisible   = false;
            }

            if (invisible)
            {
                return;
            }

            scene.PushSpriteBatch(shader: scene.Shader, shaderSetup: (matrix, projection) =>
            {
                scene.SetupColorMatrix(Color * colorMatrix, transform * matrix, projection);
            });
            scene.DrawSprite(abyssalTendril, frameOffset, pos - new Vector2(0, 8), mirror, color, 0);
            scene.PopSpriteBatch();
        }
Пример #11
0
        public override void Draw(ICurio curio, SceneGame scene, DrawPass pass)
        {
            var spriteHead   = SpriteLoader.Instance.AddSprite("content/lich_head");
            var spriteBody   = SpriteLoader.Instance.AddSprite("content/lich_body");
            var spriteHeart  = SpriteLoader.Instance.AddSprite("content/lich_heart");
            var spriteWeapon = SpriteLoader.Instance.AddSprite("content/lich_weapon");

            var center    = curio.GetVisualPosition() + new Vector2(8, 8);
            var offset    = curio.GetOffset();
            var color     = curio.GetColor();
            var angleBody = curio.GetVisualAngle();
            var lich      = curio.GetBehavior <BehaviorLich>();

            scene.PushSpriteBatch(shader: scene.Shader, shaderSetup: (transform, projection) =>
            {
                scene.SetupColorMatrix(color);
            });

            if (pass == DrawPass.EffectLow)
            {
                scene.DrawSpriteExt(spriteBody, 0, center - spriteBody.Middle, spriteBody.Middle, scene.Frame * 0.1f, new Vector2(1), SpriteEffects.None, Color.Red, 0);
                scene.DrawSpriteExt(spriteBody, 0, center - spriteBody.Middle, spriteBody.Middle, scene.Frame * 0.2f, new Vector2(0.8f), SpriteEffects.None, Color.DarkRed, 0);

                var weaponMiddle = new Vector2(spriteWeapon.Width / 2, spriteWeapon.Height * 2 / 3);
                var weaponOffset = Util.AngleToVector(lich.SwordAngle);
                scene.DrawSpriteExt(spriteWeapon, 0, center + Util.AngleToVector(angleBody) + weaponOffset * 8 - weaponMiddle, weaponMiddle, lich.SwordAngle, new Vector2(lich.SwordScale), SpriteEffects.None, Color.White, 0);

                scene.DrawSpriteExt(spriteBody, 0, center - spriteBody.Middle, spriteBody.Middle, scene.Frame * 0.3f, new Vector2(0.6f), SpriteEffects.None, Color.Black, 0);
            }
            if (pass == DrawPass.Creature)
            {
                if (!curio.IsHeartless())
                {
                    scene.DrawSpriteExt(spriteHeart, 0, center + offset - spriteHeart.Middle, spriteHeart.Middle, 0, new Vector2(1), SpriteEffects.None, Color.White, 0);
                }
            }
            if (pass == DrawPass.Effect)
            {
                var headOffset = Util.AngleToVector(angleBody) * -8;
                scene.DrawSpriteExt(spriteHead, 0, center + headOffset + offset - spriteHead.Middle, spriteHead.Middle, angleBody, new Vector2(1), SpriteEffects.None, Color.White, 0);
            }

            scene.PopSpriteBatch();
        }
Пример #12
0
        public override void Draw(ICurio curio, SceneGame scene, DrawPass pass)
        {
            var spriteIdle = SpriteLoader.Instance.AddSprite("content/rat_idle");
            var spriteMove = SpriteLoader.Instance.AddSprite("content/rat_move");
            var center     = curio.GetVisualPosition() + new Vector2(8, 8);
            var offset     = curio.GetOffset();
            var color      = curio.GetColor();
            var angleBody  = curio.GetVisualAngle();
            var pathfinder = curio.GetBehavior <BehaviorPathfinder>();

            scene.PushSpriteBatch(shader: scene.Shader, shaderSetup: (transform, projection) =>
            {
                scene.SetupColorMatrix(color);
            });
            var spriteBody = pathfinder.HasPath ? spriteMove : spriteIdle;

            scene.DrawSpriteExt(spriteBody, 0, center + offset - spriteBody.Middle, spriteBody.Middle, angleBody, new Vector2(1), SpriteEffects.None, Color.White, 0);
            scene.PopSpriteBatch();
        }
Пример #13
0
        public override void Draw(SceneGame scene, DrawPass pass)
        {
            if (Sprite == null)
            {
                return;
            }

            if (ColorMatrix.HasValue)
            {
                scene.PushSpriteBatch(shaderSetup: (matrix, projection) =>
                {
                    scene.SetupColorMatrix(ColorMatrix.Value, matrix, projection);
                });
            }
            scene.DrawSpriteExt(Sprite, SubImage, Position - Sprite.Middle, Sprite.Middle, Angle, new Vector2(Scale), Mirror, Color, 0);
            if (ColorMatrix.HasValue)
            {
                scene.PopSpriteBatch();
            }
        }
Пример #14
0
        public override void Draw(ICurio curio, SceneGame scene, DrawPass pass)
        {
            var body  = SpriteBody;
            var alive = curio.GetBehavior <BehaviorAlive>();

            if (alive.Armor > 0)
            {
                body = SpriteLoader.Instance.AddSprite($"{SpriteBody.FileName}_armor");
            }
            var center    = curio.GetVisualPosition() + new Vector2(8, 8);
            var offset    = curio.GetOffset();
            var color     = curio.GetColor();
            var angleBody = curio.GetVisualAngle();

            scene.PushSpriteBatch(shader: scene.Shader, shaderSetup: (transform, projection) =>
            {
                scene.SetupColorMatrix(color);
            });
            scene.DrawSpriteExt(body, 0, center + offset - SpriteBody.Middle, SpriteBody.Middle, angleBody, new Vector2(1), SpriteEffects.None, Color.White, 0);
            DrawDagger(curio, scene, pass);
            DrawMace(curio, scene, pass);
            scene.PopSpriteBatch();
        }
Пример #15
0
        public override void Draw(ICurio curio, SceneGame scene, DrawPass pass)
        {
            var spriteHelmetForward = SpriteLoader.Instance.AddSprite("content/player_helmet_5");
            var spriteHelmetBack    = SpriteLoader.Instance.AddSprite("content/player_helmet_4");

            var spriteBodyForward = SpriteLoader.Instance.AddSprite("content/player_forward");
            var spriteBodyBack    = SpriteLoader.Instance.AddSprite("content/player_back");

            var spriteSword      = SpriteLoader.Instance.AddSprite("content/player_sword");
            var spriteGrip       = SpriteLoader.Instance.AddSprite("content/player_grip");
            var spriteSwordBlood = SpriteLoader.Instance.AddSprite("content/player_sword_bloody");
            var spriteSwordHeart = SpriteLoader.Instance.AddSprite("content/player_sword_heart");
            var spriteWings      = SpriteLoader.Instance.AddSprite("content/player_wings");

            var sword   = curio.GetBehavior <BehaviorSword>();
            var grapple = curio.GetBehavior <BehaviorGrapplingHook>();
            var player  = curio.GetBehavior <BehaviorPlayer>();
            var alive   = curio.GetBehavior <BehaviorAlive>();

            if (alive.Armor > 0)
            {
                spriteBodyForward = SpriteLoader.Instance.AddSprite("content/player_forward_armor");
                spriteBodyBack    = SpriteLoader.Instance.AddSprite("content/player_back_armor");
            }

            var world     = curio.GetWorld();
            var center    = curio.GetVisualPosition() + new Vector2(8, 8);
            var offset    = curio.GetOffset();
            var color     = curio.GetColor();
            var angleBody = curio.GetVisualAngle();

            scene.PushSpriteBatch(shader: scene.Shader, shaderSetup: (transform, projection) =>
            {
                scene.SetupColorMatrix(color);
            });
            if (grapple != null && grapple.ShouldRender)
            {
                var angleGrapple = angleBody + grapple.VisualAngle();
                scene.DrawSpriteExt(spriteGrip, 0, center + offset - spriteGrip.Middle, spriteGrip.Middle, angleGrapple, new Vector2(1), SpriteEffects.None, Color.White, 0);
            }
            if (sword != null)
            {
                var angleSword = angleBody + sword.VisualAngle();
                if (sword.HasBlood)
                {
                    spriteSword = spriteSwordBlood;
                }
                scene.DrawSpriteExt(spriteSword, 0, center + offset - spriteSword.Middle, spriteSword.Middle, angleSword, new Vector2(sword.VisualScale()), SpriteEffects.None, Color.White, 0);
                if (sword.HasHeart)
                {
                    scene.DrawSpriteExt(spriteSwordHeart, 0, center + offset - spriteSwordHeart.Middle, spriteSwordHeart.Middle, angleSword, new Vector2(sword.VisualScale()), SpriteEffects.None, Color.White, 0);
                }
            }
            SpriteReference spriteHelmet;
            SpriteReference spriteBody;
            float           headPos = MathHelper.Lerp(-4, 4, player.ForwardBack);

            if (player.ForwardBack > 0.5f)
            {
                spriteHelmet = spriteHelmetForward;
                spriteBody   = spriteBodyForward;
            }
            else
            {
                spriteHelmet = spriteHelmetBack;
                spriteBody   = spriteBodyBack;
            }
            scene.DrawSpriteExt(spriteBody, 0, center + offset - spriteBody.Middle, spriteBody.Middle, angleBody, new Vector2(1), SpriteEffects.None, Color.White, 0);
            scene.DrawSpriteExt(spriteHelmet, (int)(player.HairFrame / 4), center + offset + Util.AngleToVector(angleBody) * headPos - spriteHelmet.Middle, spriteHelmet.Middle, angleBody, new Vector2(1), SpriteEffects.None, Color.White, 0);
            //scene.PushSpriteBatch(blendState: BlendState.Additive);
            //scene.DrawSpriteExt(spriteWings, 0, center + offset - spriteWings.Middle, spriteWings.Middle, angleBody, new Vector2(1), SpriteEffects.None, new Color(200, 192, 255), 0);
            //scene.PopSpriteBatch();
            scene.PopSpriteBatch();
        }