Beispiel #1
0
    //toggles each of the four drop zones occupied and not depending on the boolean received
    public void toggleZoneReadyGathering(CaptureScript zone)
    {
        if (gatheringDropZoneQueue.Contains(zone))
        {
            gatheringDropZoneQueue.Remove(zone);
        }
        gatheringDropZoneQueue.Add(zone);
        int index;

        gatheringZoneOccupied[index = zone.getZoneNumber() - 1] = zone.isElementCaptured();
        bool readyToEnterGathering = zone.isElementCaptured();

        if (zone.isElementCaptured())           //checks whether the rest of the zones are captured if this zone is
        //sets the name to pass on to gathering mode
        {
            elementsInDropZones[index] = zone.myElementGameObject.name;
            for (int i = 0; i < gatheringZoneOccupied.Length; i++)
            {
                if (elementsInDropZones[i] == elementsInDropZones[index] && i != index)                   //if there's already an element that is the same, delete it from the first drop zone
                {
                    gatheringDropZones[i].OnMouseDown();
                    readyToEnterGathering = false;
                }
                if (!gatheringZoneOccupied[i])                   //if a zone is unoccpied
                {
                    readyToEnterGathering = false;
                }
            }
        }
        else
        {
            elementsInDropZones[index] = noElementString;
        }
        //toggles the play button on and off
    }
Beispiel #2
0
    void Start()
    {
        //sets the text box
        toggleCraftedElement(false);

        //references to the capture scripts in the drop zones
        zone1Capturer = elementDropZone1.GetComponent <CaptureScript>();
        zone2Capturer = elementDropZone2.GetComponent <CaptureScript>();
        //reference to the child gameobject that represetns the element
        //myElementGameObject = transform.GetChild (3).gameObject;
        //myElementSprite = myElementGameObject.GetComponent<Image>();

        //sets the starting prompting text
        setEmptyMessage();

        //adds the creation function to the event
        OnElementCreated += createElement;
    }
    void Start()
    {
        if (transform.parent.name.Contains("Result"))
        {
            isCompiler = true;
        }

        if (transform.parent.name.Contains("Zone") || isCompiler)           //prevents elements in the drop zone from being scaled

        {
            isDropZone = isCompiler ? false:true;

            //script reference to capture zone controller
            zoneController = isCompiler ? GetComponent <CaptureScript>():transform.parent.GetComponent <CaptureScript>();

            //changes the sort order to make sure the zone can receive button clicks
            GetComponent <Canvas>().sortingOrder = transform.parent.GetComponent <Canvas>().sortingOrder + 1;
        }
        else
        {
            //makes the element slightly smaller
            transform.localScale = new Vector3(0.9f, 0.9f);
        }
    }
Beispiel #4
0
 private void Start()
 {
     capture = FindObjectOfType <CaptureScript>();
 }
Beispiel #5
0
 // Use this for initialization
 void Start()
 {
     captureScript = capture.GetComponent <CaptureScript>();
 }
 private void Start()
 {
     randomRot = GetComponent <RandomRotation>();
     capture   = FindObjectOfType <CaptureScript>();
 }
Beispiel #7
0
 // Used to set the CaptureScript this element is referring to
 public void setCapturer(CaptureScript capturer)
 {
     this.capturer = capturer;
 }
	void Start () {
		//sets the text box
		toggleCraftedElement(false);

		//references to the capture scripts in the drop zones
		zone1Capturer = elementDropZone1.GetComponent<CaptureScript>();
		zone2Capturer = elementDropZone2.GetComponent<CaptureScript>();
		//reference to the child gameobject that represetns the element
		//myElementGameObject = transform.GetChild (3).gameObject;
		//myElementSprite = myElementGameObject.GetComponent<Image>();

		//sets the starting prompting text
		setEmptyMessage();

		//adds the creation function to the event
		OnElementCreated += createElement;
	}
 // Used to set the CaptureScript this element is referring to
 public void setCapturer(CaptureScript capturer)
 {
     this.capturer = capturer;
 }
	//toggles each of the four drop zones occupied and not depending on the boolean received
	public void toggleZoneReadyGathering (CaptureScript zone) {
		if (gatheringDropZoneQueue.Contains(zone)) {
			gatheringDropZoneQueue.Remove(zone);
		}
		gatheringDropZoneQueue.Add(zone);
		int index;
		gatheringZoneOccupied[index = zone.getZoneNumber()-1] = zone.isElementCaptured();
		bool readyToEnterGathering = zone.isElementCaptured();
		if (zone.isElementCaptured()) { //checks whether the rest of the zones are captured if this zone is
			//sets the name to pass on to gathering mode
			elementsInDropZones[index] = zone.myElementGameObject.name;
			for (int i = 0; i < gatheringZoneOccupied.Length; i++) {
				if (elementsInDropZones[i] == elementsInDropZones[index] && i != index) { //if there's already an element that is the same, delete it from the first drop zone
					gatheringDropZones[i].OnMouseDown();
					readyToEnterGathering = false;
				} 
				if (!gatheringZoneOccupied[i]) { //if a zone is unoccpied
					readyToEnterGathering = false;
				}
			}

		} else {
			elementsInDropZones[index] = noElementString;
		}
		//toggles the play button on and off
	}