Example #1
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 #2
0
    public override void ReceiveLeaderChoice(GameObject leaderDestination)
    {
        if (leaderDestination.CompareTag("Uscita"))
        {
            Debug.Log(name + ": ricevuta nuova destinazione del leader (despota)", leaderDestination);
            Destination = leaderDestination;

            if (DestinationPrePause != null)
            {
                InPausa = false;
                ImportantIgnoratePicture.Add(DestinationPrePause.GetComponentInParent <PictureInfo>());
                lastDestinationLeader = null;
                DestinationPrePause   = null;
            }

            UpdateDestinationPointForNoChoiceExit();
            GoToDestinationPoint();
            return;
        }


        if (!VisitedPictures.Contains(leaderDestination.GetComponentInParent <PictureInfo>()))
        {
            if (DestinationPrePause)
            {
                ImportantIgnoratePicture.Add(DestinationPrePause.GetComponentInParent <PictureInfo>());
            }

            lastDestinationLeader = leaderDestination.GetComponentInParent <PictureInfo>();
        }
    }