示例#1
0
        public void Attack()
        {
            visible_timer = 0;
            exists        = true;
            facing        = _root.facing;
            Play("stab", true);
            SoundManager.PlaySoundEffect("swing_broom_1", "swing_broom_2", "swing_broom_3");

            UpdatePos();

            GlobalState.FireEvent(new BroomUsed());

            if (GlobalState.IsKnife && GlobalState.events.GetEvent("Stabbed") == 0)
            {
                GlobalState.events.IncEvent("Stabbed");

                GlobalState.inventory.EquippedBroomChanged = true;
            }

            if (dust != null)
            {
                dust.Position = (_root.Center / 16 + FacingDirection(_root.facing)).ToPoint().ToVector2() * 16;

                if (GlobalState.Map.GetCollisionData(dust.Position) == Touching.NONE)
                {
                    dust.exists = true;
                    dust.Play("unpoof", true);
                    just_released_dust = true;
                    //dust-dust check done next frame by dust itself
                }
            }
        }
示例#2
0
 public override void PostUpdate()
 {
     base.PostUpdate();
     velocity    = Vector2.Zero;
     ON_CONVEYOR = false;
     if (_curAnim.Finished && (_curAnim.name == "fallpoof" || _curAnim.name == "poof"))
     {
         exists = false;
         if (_curAnim.name == "fallpoof")
         {
             GlobalState.FireEvent(new DustFallEvent());
         }
     }
 }
示例#3
0
        public override void GetTreasure()
        {
            base.GetTreasure();

            if (GlobalState.inventory.CardStatus[_curAnim.Frame])
            {
                exists = false;
                GlobalState.FireEvent(new EmptyTreasureEvent());
                return;
            }


            GlobalState.inventory.CardStatus[_curAnim.Frame] = true;

            DebugLogger.AddInfo($"Got card {_curAnim.Frame}");
        }
示例#4
0
        IEnumerator <CutsceneEvent> WindmillCutscene()
        {
            VolumeEvent e      = new(0f, 0.6f);
            Entity      statue = new(Vector2.Zero, "big_statue", 32, 48, Drawing.DrawOrder.ENTITIES)
            {
                visible = false
            };

            yield return(new EntityEvent(new List <Entity>()
            {
                e, statue
            }));

            while (!e.ReachedTarget)
            {
                yield return(null);
            }

            GlobalState.gameScreenFade.fadeColor = Color.Black;
            while (!MathUtilities.MoveTo(ref GlobalState.gameScreenFade.alpha, 1, 0.6f))
            {
                yield return(null);
            }

            List <(string map, Point grid, Vector2 tile)> locs = new()
            {
                ("BEDROOM", new(4, 0), new(5, 2)),
                ("REDCAVE", new(6, 2), new(4, 4)),
                ("CROWD", new(9, 4), new(4, 2))
            };

            for (int i = 0; i < 3; ++i)
            {
                var(map, grid, tile) = locs[i];
                statue.Position      = MapUtilities.GetRoomUpperLeftPos(grid) + tile * 16;
                statue.SetFrame(i);
                statue.visible = true;
                yield return(new WarpEvent(map, grid));

                while (!MathUtilities.MoveTo(ref GlobalState.gameScreenFade.alpha, 0.45f, 0.6f))
                {
                    yield return(null);
                }
                SoundManager.PlaySoundEffect("red_cave_rise");
                while (!MathUtilities.MoveTo(ref GlobalState.gameScreenFade.alpha, 0, 0.6f))
                {
                    yield return(null);
                }
                Vector2 target = statue.Position + FacingDirection(DungeonStatue.MoveDir(i)) * 32;
                while (!MathUtilities.MoveTo(ref statue.Position.X, target.X, 12)
                       | !MathUtilities.MoveTo(ref statue.Position.Y, target.Y, 12))
                {
                    yield return(null);
                }
                GlobalState.screenShake.Shake(0.05f, 0.5f);
                SoundManager.PlaySoundEffect("wb_hit_ground");

                while (!MathUtilities.MoveTo(ref GlobalState.gameScreenFade.alpha, 1, 0.6f))
                {
                    yield return(null);
                }
                statue.visible = false;
            }
            statue.exists = false;

            yield return(new ReturnWarp());

            e.SetTarget(1);
            while (!MathUtilities.MoveTo(ref GlobalState.gameScreenFade.alpha, 0, 0.6f) | !e.ReachedTarget)
            {
                yield return(null);
            }

            SoundManager.PlaySong("windmill");
            GlobalState.events.IncEvent("WindmillOpened");
            GlobalState.FireEvent(new OpenedWindmill());

            yield break;
        }
    }