public static void ResetValues()
        {
            DebugLogger.AddInfo("Setting achievement progress to default");
            AchievementStatus = Enumerable.Repeat(false, 18).ToArray();

            AchievementsDisabled = false;
        }
Пример #2
0
        public override void GetTreasure()
        {
            base.GetTreasure();

            GlobalState.inventory.SecretStatus[_secretID] = true;

            DebugLogger.AddInfo($"Got secret {_secretID}");
        }
Пример #3
0
        public override void GetTreasure()
        {
            base.GetTreasure();

            InventoryManager.CardStatus[_curFrame] = true;

            DebugLogger.AddInfo($"Got card {_curFrame}");

            AchievementManager.CheckCardAchievements();
        }
Пример #4
0
        public override void GetTreasure()
        {
            base.GetTreasure();

            InventoryManager.SecretStatus[_secretID] = true;

            DebugLogger.AddInfo($"Got secret {_secretID}");

            AchievementManager.CheckCubeAchievements();
        }
Пример #5
0
        protected virtual void TeleportPlayer()
        {
            DebugLogger.AddInfo($"Teleporting player to map {_linkedDoor.Map} at {_linkedDoor.Door.Position.X}, {_linkedDoor.Door.Position.Y}. Door pair {_linkedDoor.Door.Frame}.");
            _linkedDoor.Warp(teleportOffset);
            player_on_door = true;

            if (_sfx != null)
            {
                SoundManager.PlaySoundEffect(_sfx);
            }
        }
Пример #6
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}");
        }
Пример #7
0
        public static void ResetValues()
        {
            DebugLogger.AddInfo("Setting inventory progress to default");

            _mapKeys = new Dictionary <string, int>();

            CardStatus   = Enumerable.Repeat(false, 49).ToArray();
            SecretStatus = Enumerable.Repeat(false, 13).ToArray();

            HasBroom       = false;
            HasLenghten    = false;
            HasWiden       = false;
            HasTransformer = false;

            CanJump = false;
        }
Пример #8
0
        public static int AddMapKey(string mapName, int addition)
        {
            GlobalState.RefreshKeyCount = true;

            if (!_mapKeys.ContainsKey(mapName))
            {
                _mapKeys.Add(mapName, addition);
            }
            else
            {
                _mapKeys[mapName] += addition;
            }

            DebugLogger.AddInfo($"Set key count of {mapName} to {_mapKeys[mapName]}");

            return(_mapKeys[mapName]);
        }
Пример #9
0
        private static void ReadEntities(string xml)
        {
            var type_lookup = (from t in Assembly.GetExecutingAssembly().GetTypes()
                               where t.IsDefined(typeof(NamedEntity), false)
                               group new { type = t, check = t.GetCustomAttribute <NamedEntity>() } by t.GetCustomAttribute <NamedEntity>().GetName(t)
                               ).ToDictionary(t => t.Key, t => t.ToList());

            HashSet <string> missing = new HashSet <string>();

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);

            XmlNode root = doc.FirstChild;

            List <DoorMapPair> doors = new List <DoorMapPair>();

            if (root.HasChildNodes)
            {
                for (int i = 0; i < root.ChildNodes.Count; i++)
                {
                    var map = root.ChildNodes[i];

                    string mapName = map.Attributes.GetNamedItem("name").Value;

                    if (!_entities.ContainsKey(mapName))
                    {
                        _entities.Add(mapName, new List <EntityPreset>());
                    }
                    List <EntityPreset> presets = _entities[mapName];

                    foreach (XmlNode child in map.ChildNodes)
                    {
                        if (!type_lookup.ContainsKey(child.Name))
                        {
                            if (!missing.Contains(child.Name))
                            {
                                DebugLogger.AddWarning($"Missing Entity {child.Name}!");
                                missing.Add(child.Name);
                            }
                            continue;
                        }
                        if (int.TryParse(child.Attributes.GetNamedItem("x").Value, out int x) &&
                            int.TryParse(child.Attributes.GetNamedItem("y").Value, out int y) &&
                            Guid.TryParse(child.Attributes.GetNamedItem("guid").Value, out Guid id) &&
                            int.TryParse(child.Attributes.GetNamedItem("frame").Value, out int frame))
                        {
                            Permanence p = Permanence.GRID_LOCAL;

                            if (child.Attributes.GetNamedItem("p") != null)
                            {
                                p = (Permanence)int.Parse(child.Attributes.GetNamedItem("p").Value);
                            }

                            string type = "";

                            if (child.Attributes.GetNamedItem("type") != null)
                            {
                                type = child.Attributes.GetNamedItem("type").Value;
                            }

                            bool alive = true;

                            if (child.Attributes.GetNamedItem("alive") != null)
                            {
                                alive = bool.Parse(child.Attributes.GetNamedItem("alive").Value);
                            }

                            var matching = type_lookup[child.Name].FindAll(t => t.check.Matches(frame, type)).ToList();
                            if (matching.Count == 0)
                            {
                                string missing_entity = $"{child.Name}-{frame}-'{type}'";
                                if (!missing.Contains(missing_entity))
                                {
                                    missing.Add(missing_entity);
                                    DebugLogger.AddWarning($"Missing Entity {missing_entity}!");
                                }
                            }
                            else if (matching.Count > 1)
                            {
                                DebugLogger.AddWarning($"Conflict at {child.Name}-{frame}-'{type}': " + String.Join(", ", matching.Select(t => t.type.Name)));
                            }
                            else
                            {
                                EntityPreset preset = new EntityPreset(matching[0].type, new Vector2(x, y), id, frame, p, type, alive);

                                presets.Add(preset);

                                if (child.Name == "Door")
                                {
                                    DoorMapPair newDoor = new DoorMapPair(preset, mapName);

                                    if (doors.Any(d => d.Door.Frame == preset.Frame))
                                    {
                                        DoorMapPair doorOne = doors.First(d => d.Door.Frame == preset.Frame);
                                        _doorPairs.Add(preset.Frame, new DoorPair(doorOne, newDoor));

                                        doors.Remove(doorOne);

                                        DebugLogger.AddInfo($"DOOR PAIR {preset.Frame}\n{doorOne.Door.Position.X} {doorOne.Door.Position.Y} {doorOne.Map}\n{newDoor.Door.Position.X} {newDoor.Door.Position.Y} {newDoor.Map}");
                                    }
                                    else
                                    {
                                        doors.Add(newDoor);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #10
0
 protected virtual void TeleportPlayer()
 {
     //TODO: Screen transition
     DebugLogger.AddInfo($"Teleporting player to map {_linkedDoor.Map} at {_linkedDoor.Door.Position.X}, {_linkedDoor.Door.Position.Y}. Door pair {_linkedDoor.Door.Frame}.");
 }