protected override void OnUpdate(GameplayScreen gameplayScreen)
        {
            if (ItemInfo == null || hasReplacedItemScript || (Point)Dynamic.DeathPosition == Point.Zero)
            {
                return;
            }

            var eventTypes = ((Dictionary <int, GameEvent>)LevelReflected._levelEvents).Values.Select(e => e.GetType());

            if (!eventTypes.Contains(SandStreamerEventType))
            {
                return;
            }

            if (((Dictionary <int, Item>)LevelReflected._items).Count == 0)
            {
                var itemDropPickupType = TimeSpinnerType.Get("Timespinner.GameObjects.Items.ItemDropPickup");
                var itemPosition       = (Point)Dynamic.Position;
                var itemDropPickup     = Activator.CreateInstance(itemDropPickupType, ItemInfo.BestiaryItemDropSpecification, Level, itemPosition, -1);

                LevelReflected.RequestAddObject((Item)itemDropPickup);
            }

            hasReplacedItemScript = true;
        }
Example #2
0
        void RemoveDemonsAndSpawnItem()
        {
            Incubus.Disappear();
            Succubus.Disappear();

            var sandStreamerEventType = TimeSpinnerType.Get("Timespinner.GameObjects.Events.Misc.SandStreamerEvent");
            var sandStreamerEnumType  = TimeSpinnerType.Get("Timespinner.GameObjects.Events.Misc.ESandStreamerType");
            var bossDeathEnumValue    = Enum.Parse(sandStreamerEnumType, "BossDeath");
            var sandStreamerEvent     = Activator.CreateInstance(sandStreamerEventType, Level, ((Rectangle)Incubus.Bbox).Center, bossDeathEnumValue);

            Level.AddEvent((GameEvent)sandStreamerEvent);

            var itemDropPickupType = TimeSpinnerType.Get("Timespinner.GameObjects.Items.ItemDropPickup");
            var itemPosition       = new Point(((Point)Succubus.Position).X, ((Rectangle)Succubus.Bbox).Top);
            var itemDropPickup     = Activator.CreateInstance(itemDropPickupType, ItemInfo.BestiaryItemDropSpecification, Level, itemPosition, -1);

            LevelReflected.RequestAddObject((Item)itemDropPickup);
        }