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;
}