Exemple #1
0
        public ItemProfile GetProfile(bool includeContent = true)
        {
            ItemProfile profile = new ItemProfile();

            profile.id = id;

            if (showContent && includeContent)
            {
                profile.showContent = true;

                ItemProfile[] itemsInsideProfiles = new ItemProfile[itemsInside.Count];

                for (int i = 0, count = itemsInside.Count; i < count; i++)
                {
                    itemsInsideProfiles[i] = itemsInside[i].GetProfile(includeContent);
                }

                profile.itemsInsideProfiles = itemsInsideProfiles;
            }
            else
            {
                profile.showContent = false;
            }

            profile.position = transform.position;

            return(profile);
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            ItemProfile profile = (ItemProfile)obj;

            if (profile == null || profile.id != id || profile.showContent != showContent)
            {
                return(false);
            }

            if (showContent)
            {
                int length = itemsInsideProfiles.Length;

                if (length != profile.itemsInsideProfiles.Length)
                {
                    return(false);
                }

                for (int i = 0; i < length; i++)
                {
                    if (itemsInsideProfiles[i] != profile.itemsInsideProfiles[i])
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Exemple #3
0
        public Paradox(int time, GameObject visuals, ItemProfile itemProfile)
        {
            this.time        = time;
            this.visuals     = visuals;
            this.itemProfile = itemProfile;

            type = ParadoxType.Item;
        }
        public bool CompareSurface(ItemProfile profile)
        {
            if (profile == null || profile.id != id || profile.showContent != showContent)
            {
                return(false);
            }

            return(true);
        }
        public ActionDrop(int time, int duration, Item item, Item itemContainer)
        {
            this.time                 = time;
            this.duration             = duration;
            this.itemProfile          = item.GetProfile(false);
            this.itemContainerProfile = itemContainer.GetProfile(false);

            pickupOffset = item.transform.position.y - item.characterCarrying.pickupPivot.position.y;
            towardsPos   = itemContainer.GetDropPosition();
        }
Exemple #6
0
        public void CompareObservations(Observation currentObservation, Observation expectedObservation)
        {
            List <Character> currentCharacters = new List <Character>(currentObservation.characters);

            //Expected Characters
            for (int i = 0, count = expectedObservation.characters.Count; i < count; i++)
            {
                Character character = expectedObservation.characters[i];

                if (currentCharacters.Remove(character) == false)
                {
                    Paradox paradox = new Paradox(currentObservation.time, visualsMeet, character);
                    currentParadoxes.Add(paradox);
                }
            }

            //Unexpected Characters
            for (int i = 0, count = currentCharacters.Count; i < count; i++)
            {
                Paradox paradox = new Paradox(currentObservation.time, visualsMeet, currentCharacters[i]);
                currentParadoxes.Add(paradox);
            }

            //Expected Items
            List <ItemProfile> currentItemProfiles = new List <ItemProfile>(currentObservation.itemProfiles);

            for (int i = 0, count = expectedObservation.itemProfiles.Count; i < count; i++)
            {
                ItemProfile expectedProfile = expectedObservation.itemProfiles[i];

                if (currentItemProfiles.Remove(expectedProfile) == false)
                {
                    //Expected item not found, locate paradoxes
                    for (int s = 0, currentCount = currentItemProfiles.Count; s < currentCount; s++)
                    {
                        ItemProfile currentProfile = currentItemProfiles[s];

                        if (currentProfile.CompareSurface(expectedProfile))
                        {
                            for (int t = 0; t < expectedProfile.itemsInsideProfiles.Length; t++)
                            {
                                ItemProfile expectedInsideProfile = expectedProfile.itemsInsideProfiles[t];

                                if (currentProfile.itemsInsideProfiles.Length <= t || expectedInsideProfile != currentProfile.itemsInsideProfiles[t])
                                {
                                    Paradox paradox = new Paradox(currentObservation.time, visualsMeet, expectedInsideProfile);
                                    currentParadoxes.Add(paradox);
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #7
0
        public ActionPickup(int time, int duration, Item item, Item itemContainer, Location location, float pickupOffset)
        {
            this.time                 = time;
            this.duration             = duration;
            this.itemProfile          = item.GetProfile();
            this.itemContainerProfile = itemContainer.GetProfile();

            this.fromPos      = item.transform.position;
            this.location     = location;
            this.pickupOffset = pickupOffset;

//			Debug.Log(itemContainer.GetId().ToString() +","+item.GetId().ToString());
        }
Exemple #8
0
        public Item FindContainer()
        {
            for (int i = 0, count = location.items.Count; i < count; i++)
            {
                Item        container        = location.items[i];
                ItemProfile containerProfile = container.GetProfile();

                if (itemContainerProfile.CompareSurface(containerProfile))
                {
                    return(container);
                }
            }

            return(null);
        }