Ejemplo n.º 1
0
        /// <summary>
        /// Continuously checks where player is and sets target true/false based on site properties.
        /// </summary>
        public override void Update(Task caller)
        {
            bool result = false;

            // Get place resource
            Place place = ParentQuest.GetPlace(placeSymbol);

            if (place == null)
            {
                return;
            }

            // Check building site
            if (place.SiteDetails.siteType == SiteTypes.Building)
            {
                result = CheckInsideBuilding(place);
            }
            else if (place.SiteDetails.siteType == SiteTypes.Town)
            {
                result = CheckInsideTown(place);
            }
            else if (place.SiteDetails.siteType == SiteTypes.Dungeon)
            {
                result = CheckInsideDungeon(place);
            }

            // Handle positive check
            if (result)
            {
                // "saying" popup
                // TODO: Should this run every time or only once?
                if (textId != 0)
                {
                    ParentQuest.ShowMessagePopup(textId);
                }

                // Enable target task
                ParentQuest.SetTask(taskSymbol);
            }
            else
            {
                // Disable target task
                ParentQuest.UnsetTask(taskSymbol);
            }
        }