Example #1
0
    private bool SelectNextPicInBackwardWalls(List <GameObject> considerateWall)
    {
        utilitySort.picturesOnWalls = picturesOnWalls;
        considerateWall.Sort(utilitySort.SortByIndexPictureInWalls);

        GameObject wallWithPictureSmallerIndex = considerateWall[0];

        if (picturesOnWalls.ContainsKey(wallWithPictureSmallerIndex))
        {
            List <PictureInfo> consideratePics = picturesOnWalls[wallWithPictureSmallerIndex];
            consideratePics.Sort(utilitySort.DistanzaPicture);

            PictureInfo mostClosePicture = consideratePics[0];

            nextDestination     = mostClosePicture.GetComponentInChildren <GridSystem>().gameObject;
            CurrentPictureIndex = mostClosePicture.index;

            consideratePics.Remove(mostClosePicture);

            if (consideratePics.Count <= 0)
            {
                picturesOnWalls.Remove(wallWithPictureSmallerIndex);
            }

            return(true);
        }

        return(false);
    }
Example #2
0
    public override GameObject GetNextDestination()
    {
        if ((ImportantPictures.Count <= 0 && groupData.LeaderIsAlive) || FatigueLevel >= FatigueManager.Level.MOLTO_STANCO)
        {
            return(GetPlaneOfExit());
        }

        if (picturesToWatch.MoveNext())
        {
            if (VisitedPictures.Contains(picturesToWatch.Current))
            {
                return(GetNextDestination());
            }

            GameObject pictureGrid = picturesToWatch.Current.GetComponentInChildren <GridSystem>().gameObject;
            return(pictureGrid);
        }

        if (ImportantPictures.Count > 0)
        {
            PictureInfo importantPicture = ImportantPictures[ImportantPictures.Count - 1];
            ImportantPictures.Remove(importantPicture);

            return(importantPicture.GetComponentInChildren <GridSystem>().gameObject);
        }


        return(GetPlaneOfExit());
    }
Example #3
0
    private void CheckLeaderDestination()
    {
        if (lastDestinationLeader.CompareTag("Empty Space"))
        {
            Destination = lastDestinationLeader.gameObject;
        }
        else
        {
            Destination = lastDestinationLeader.GetComponentInChildren <GridSystem>().gameObject;
        }

        bool IgnoreDestination = ImportantIgnoratePicture.Contains(Destination.GetComponentInParent <PictureInfo>());

        if (!IgnoreDestination)
        {
            if (Destination.GetComponent <GridSystem>().HaveAvailablePoint())
            {
                if (!Destination.CompareTag("Empty Space"))
                {
                    VisitedPictures.Add(Destination.GetComponentInParent <PictureInfo>());
                }
            }
            else
            {
                InPausa = true;

                DestinationPrePause = Destination;
                Destination         = GetMostCloseEmptySpace(groupData.leader.GetComponent <BotVisitData>().destinationPoint.transform);
            }
        }

        lastDestinationLeader = null;
        UpdateDestinationPoint();
        GoToDestinationPoint();
    }
Example #4
0
 public int DistanzaPicture(PictureInfo x, PictureInfo y)
 {
     return(Distanza(x.GetComponentInChildren <GridSystem>().gameObject, y.GetComponentInChildren <GridSystem>().gameObject));
 }