示例#1
0
        public void MoveTick(Vector2 direction)
        {
            SparkFrame += Curio.GetWorld().TimeModCurrent;
            if (SparkFrame.Done)
            {
                SparkFrame.Reset();

                if (Position == 0)
                {
                    return;
                }

                var tile     = Curio.GetMainTile();
                var angle    = Curio.GetAngle() + Position * MathHelper.PiOver4;
                var offset   = Util.AngleToVector(angle).ToTileOffset();
                var neighbor = tile.GetNeighborOrNull(offset.X, offset.Y);
                if (neighbor != null && neighbor.IsSolid())
                {
                    Vector2 sparkDirection = direction;
                    if (Position < 0)
                    {
                        sparkDirection = sparkDirection.TurnLeft();
                    }
                    if (Position > 0)
                    {
                        sparkDirection = sparkDirection.TurnRight();
                    }
                    Vector2 tip = GetBlade(8);
                    for (int i = 0; i < 3; i++)
                    {
                        Vector2 randomOffset = Util.AngleToVector(Random.NextAngle()) * 20;
                        new SparkParticle(Curio.GetWorld(), SpriteLoader.Instance.AddSprite("content/effect_cinder"), tip, 10)
                        {
                            Velocity     = sparkDirection * Random.Next(24, 48) + randomOffset,
                            Color        = Color.White,
                            Size         = Random.NextFloat(),
                            VelocityLerp = LerpHelper.QuadraticIn,
                            DrawPass     = DrawPass.EffectCreatureAdditive,
                        };
                    }
                }
            }
        }
        public void OnMove(EventMove.Finish e)
        {
            if (e.Curio != Curio)
            {
                return;
            }

            var orientable = Curio.GetBehavior <BehaviorOrientable>();

            var trail = new Curio(Template.BloodThornTrail);

            trail.MoveTo(e.Source);
            trail.GetBehavior <BehaviorTrailBloodThorn>().Shooter = Projectile.Shooter;
            new TrailParticle(Curio.GetWorld(), SpriteLoader.Instance.AddSprite("content/bloodthorn"), Curio.GetVisualTarget(), 30)
            {
                Angle    = orientable.Angle,
                FadeLerp = LerpHelper.QuadraticIn,
            };
        }
        bool PerformSpecialAction()
        {
            var world      = Curio.GetWorld();
            var orientable = Curio.GetBehavior <BehaviorOrientable>();
            var delta      = world.PlayerCurio.GetVisualTarget() - Curio.GetVisualTarget();
            var distance   = delta.Length();

            var attacks = Curio.GetBehaviors <IGruntAttack>().Shuffle(Random).OrderByDescending(x => x.Priority);

            foreach (var attack in attacks)
            {
                if (attack.CanUse())
                {
                    attack.Perform();
                    return(true);
                }
            }

            return(false);
        }
示例#4
0
 public void Tick(SceneGame scene)
 {
     BellTime += scene.TimeModCurrent;
     if (BellTime.Done && BellTolls < 12)
     {
         new ScreenGlitchFlash(scene, slide => Params.WithIntensity(slide), 10);
         new ScreenFlashSimple(scene, ColorMatrix.Tint(Color.Red), LerpHelper.Flick, 10);
         SoundBell.Play(1, Random.NextFloat(0.5f, 0.0f), 0);
         BellTolls += 1;
         BellTime.Reset();
         if (BellTolls >= 12)
         {
             new ScreenBellWraiths(Curio.GetWorld(), this, 60, 300);
             foreach (var wraithEmitter in Manager.GetBehaviors().OfType <BehaviorWraithEmitter>())
             {
                 wraithEmitter.Activated = true;
             }
             SoundSummon.Play(1, 0, 0);
         }
     }
 }
        public bool IsCompleted()
        {
            var world = Curio.GetWorld();

            return(world.WaitForCutscene);
        }
示例#6
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();
        }