Example #1
0
        public void OnItemOfInterestLeave()
        {
            Visitable visitable = null;

            if (worlditem.Is <Visitable>(out visitable))
            {
                Creature  creature           = null;
                WorldItem lastItemOfInterest = visitable.LastItemOfInterestToLeave;
                LandTrap  landTrap           = null;
                WaterTrap waterTrap          = null;
                if (lastItemOfInterest.Is <LandTrap>(out landTrap))
                {
                    landTrap.IntersectingDens.Remove(this);
                }
                else if (lastItemOfInterest.Is <WaterTrap>(out waterTrap))
                {
                    waterTrap.IntersectingDens.Remove(this);
                }
            }
        }
Example #2
0
        public void OnItemOfInterestVisit()
        {
            //Debug.Log("On item of interest visit");
            Visitable visitable = null;

            if (worlditem.Is <Visitable>(out visitable))
            {
                Creature  creature           = null;
                ITrap     trap               = null;
                WorldItem lastItemOfInterest = visitable.LastItemOfInterestToVisit;
                LandTrap  landTrap           = null;
                WaterTrap waterTrap          = null;
                if (lastItemOfInterest.Is <LandTrap>(out landTrap) && !landTrap.Exceptions.Contains(NameOfCreature))
                {
                    //Debug.Log("Found a land trap");
                    landTrap.IntersectingDens.SafeAdd(this);
                }
                else if (lastItemOfInterest.Is <WaterTrap>(out waterTrap) && !waterTrap.Exceptions.Contains(NameOfCreature))
                {
                    //Debug.Log("Found a water trap");
                    waterTrap.IntersectingDens.SafeAdd(this);
                }
            }
        }