// public override void DragStarted() { // Debug.Log("DRAG STARDED!"); // } // public override void DragAborted() { // Debug.Log("DRAG ABORTED!"); // } public override void DragFinished(GameObject itemDragObject) { if (ingameHandler.gamePoints >= price) { ingameHandler.RemovePoints(price); Vector3 effectPosition = Camera.main.ScreenToWorldPoint(itemDragObject.transform.position); effectPosition.z = 1; GameObject gravitationsfield = Instantiate(gravitationsfieldObject, effectPosition, Quaternion.identity); } }
public override void DragFinished(GameObject itemDragObject) { if (ingameHandler.gamePoints >= price) { ingameHandler.RemovePoints(price); Vector3 newPosition = Vector3.back; Vector3 targetPosition = Camera.main.ScreenToWorldPoint(itemInHand.transform.position); Vector3 difference = targetPosition - newPosition; float rotationZ = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg; GameObject rocketObject = Instantiate(simplerocketObject, newPosition, Quaternion.Euler(.0f, .0f, rotationZ - 90f)); Destroy(dottedLineObjectClone); // rocketObject.GetComponent<ItemEffectSimplerocket>().StartMoving((targetPosition - rocketObject.transform.position).normalized); rocketObject.GetComponent <ItemEffectSimplerocket>().StartMoving(targetPosition); } }