Draggable.Start C# (CSharp) Method

Start() private method

private Start ( ) : void
return void
    void Start()
    {
        Handle = (Handle == null) ? gameObject : handle;
    }

Usage Example

示例#1
0
    public void OnBeginDrag(PointerEventData pointerDrag)
    {
        newObject = objectPool.GetObject();
        newObject.transform.position = this.transform.position + new Vector3(30, -30, 0);
        newObject.transform.SetParent(this.transform, true);

        // make sure orientation is correct
        int check = (int)Mathf.Round(newObject.transform.localScale.x);

        if (check == -1)
        {
            newObject.transform.Find("Image").localScale = new Vector3(1, 1, 1);
            newObject.transform.Find("Image").gameObject.GetComponent <Image>().color = new Color32(255, 255, 255, 255);
        }

        if (typeOfItems == Draggable.Slot.Value)
        {
            newObject.GetComponent <HasValue>().SetValue(1);
        }
        else if (typeOfItems == Draggable.Slot.Variable)
        {
            newObject.GetComponent <HasValue>().SetValue(gameController.GetEquation().variableValue);
        }

        if (newObject.transform.Find("Coefficient") != null)
        {
            Coefficient coef = newObject.transform.Find("Coefficient").gameObject.GetComponent <Coefficient>();
            coef.SetValue(1);
        }

        childScript = newObject.GetComponent <Draggable>();
        childScript.ShowOnPositiveSide();
        childScript.Start();
        childScript.typeOfItem     = typeOfItems;
        childScript.gameController = gameController;
        childScript.OnBeginDrag(pointerDrag);
        childScript.parentToReturnTo = this.gameObject.transform;
    }
Draggable