public void OnButtonClicked(int destinationButtonNumber)
    {
        foreach (DestinationButton button in destinationButtons)
        {
            if (button.buttonNum != destinationButtonNumber && button != null)
            {
                button.GetComponent <OnClickColors>().OnOtherButtonClicked();
            }

            else
            {
                lastButtonClicked = button;
            }
        }
    }
    public void Start()
    {
        //droneManager = GameObject.Find ("DroneManager").GetComponent<DroneManager>();

        //check to see what kind of destination button this is attached to
        if (GetComponent <DestinationButton>() != null)
        {
            destinationButton = GetComponent <DestinationButton>();
            isMapButton       = false;
        }
        if (GetComponent <DestinationMapButton>() != null)
        {
            destinationMapButton = GetComponent <DestinationMapButton>();
            isMapButton          = true;
        }
    }
Beispiel #3
0
    public void Generate(int destNum)
    {
        SO_Destination thisDest    = destinations[destNum];
        SO_Package     thisPackage = packages[0];

        thisDest.desiredPackage = thisPackage;

        destinations.Remove(thisDest);
        destsWithPkgs.Add(thisDest);

        packages.Remove(thisPackage);
        packagesWithDests.Add(thisPackage);

        SetPackageWeight(thisPackage);
        SetPackagePoints(thisPackage);

        thisDest.desiredPackage = thisPackage;

        GameObject        newDestButton  = Instantiate(destinationButtonPrefab);
        DestinationButton thisDestButton = newDestButton.GetComponent <DestinationButton>();

        thisDestButton.sO_Destination = thisDest;
        thisDestButton.sO_Package     = thisDest.desiredPackage;
        //thisDestButton.droneManager = droneManager;
        //thisDestButton.destinationManager = this;
        //thisDestButton.pointManager = pointManager;
        thisDestButton.buttonNum = buttonNum;
        thisDestButton.mapButton = destMapButtons[thisDest.destNum];
        thisDestButton.mapButton.SetActive(true);

        thisDestButton.destMapButton = thisDestButton.mapButton.GetComponent <DestinationMapButton>();
        thisDestButton.destMapButton.destinationButton        = thisDestButton;
        thisDestButton.destMapButton.sO_Package               = thisPackage;
        thisDestButton.destMapButton.destinationButtonManager = destinationButtonManager;

        buttonNum++;
        destinationButtonManager.destinationButtons.Add(thisDestButton);
        thisDestButton.StartDestroyTimer();

        newDestButton.transform.SetParent(destinationSelectWindow.transform);
        newDestButton.transform.localScale = Vector3.one;
        newDestButton.GetComponent <Button>().onClick.AddListener(() => { destinationButtonManager.OnButtonClicked(thisDestButton.buttonNum); });

        thisDestButton.Display();
    }