コード例 #1
0
 // When passing over a slot, make it the slot this will return to when releasing the mouse
 public void onSlot(FuzzyGUISlot slot)
 {
     if (this.slot) this.slot.removeElement(); // Notice the last slot that this is removed
     this.slot = slot;
     this.transform.parent = slot.transform;	// Parent to the slot!
     if (!dragged && slot) setTarget(Vector3.zero); // setTarget(slot.transform.position);
 }
コード例 #2
0
    public void Awake()
    {
        base.Awake();

        //textMesh.characterSize = 12;
        //textMesh.transform.localPosition = new Vector3(0,20,0);

        GameObject slotPrefab = Resources.Load("GUISlotPrefab") as GameObject;

        // INPUT

        // The subject
        GameObject slotGo;
        slotGo = Instantiate(slotPrefab) as GameObject;
        slotGo.transform.parent = transform;
        slotGo.transform.localPosition = new Vector3(0,0,0);
        inSubSlot = slotGo.GetComponent<FuzzyGUISlot>();
        inSubSlot.addListener(0,this);
        inSubSlot.setAttachTo(GUIElementType.SUBJECT);
        inSubSlot.setName("InSub");

        // The adjective
        slotGo = Instantiate(slotPrefab) as GameObject;
        slotGo.transform.parent = transform;
        slotGo.transform.localPosition = new Vector3(X_SPAN*1,0,0);
        inAdjSlot = slotGo.GetComponent<FuzzyGUISlot>();
        inAdjSlot.addListener(1,this);
        inAdjSlot.setAttachTo(GUIElementType.ADJECTIVE);
        inAdjSlot.setName("InAdj");

        // OUTPUT

        // The subject
        slotGo = Instantiate(slotPrefab) as GameObject;
        slotGo.transform.parent = transform;
        slotGo.transform.localPosition = new Vector3(X_SPAN*2,0,0);
        outSubSlot = slotGo.GetComponent<FuzzyGUISlot>();
        outSubSlot.addListener(2,this);
        outSubSlot.setAttachTo(GUIElementType.SUBJECT);
        outSubSlot.setName("OutSub");

        // The adjective
        slotGo = Instantiate(slotPrefab) as GameObject;
        slotGo.transform.parent = transform;
        slotGo.transform.localPosition = new Vector3(X_SPAN*3,0,0);
        outAdjSlot = slotGo.GetComponent<FuzzyGUISlot>();
        outAdjSlot.addListener(3,this);
        outAdjSlot.setAttachTo(GUIElementType.ADJECTIVE);
        outAdjSlot.setName("OutAdj");

        parseRule();
    }