Esempio n. 1
0
        public void Remove(Impassable i)
        {
            if (Impassables == null)
            {
                RemoveAfterLoad.Add(i);
                return;
            }

            foreach (var location in Impassables.Keys.ToList())
            {
                if (Impassables[location] == i)
                {
                    Impassables.Remove(location);

                    if (i.GetComponent<Interactable>())
                    {
                        Interactables.Remove(location);
                    }
                    break;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Used to update the location of NPCs walking around the map
        /// </summary>
        /// <param name="i"></param>
        public void UpdateLocation(Impassable i)
        {
            foreach (var location in Impassables.Keys.ToList())
            {
                if (Impassables[location] == i)
                {
                    Impassables.Remove(location);
                    Impassables.Add(i.gameObject.transform.position, i);

                    // If this NPC is also interactable, we need to update that location as well
                    if (i.GetComponent<Interactable>())
                    {
                        Interactables.Remove(location);
                        Interactables.Add(i.gameObject.transform.position, i.GetComponent<Interactable>());
                    }
                    break;
                }
            }
        }