/// <summary> /// Spawns ball. /// </summary> /// <param name="index">The index.</param> public void SpawnBall(int index) { if (index > -1 && index < BallElements.Length) { if (BallObject != null) { ResetBall(); } else { ballSpawnPosition = PlacementManager.Instance.HitPosition; GameObject newObject = Instantiate(BallElements[index].PrefabObject, ballSpawnPosition, Quaternion.identity); newObject.transform.SetParent(ObjectContainer.transform, false); BallObject = newObject.GetComponent <PhysicObject>(); BallObject.ARBase.ID = -1; } PlacementManager.Instance.SetSelectedObject(BallObject.ARBase); StartCoroutine("MoveBallToHighestSnap"); } }
/// <summary> /// Reset. /// </summary> public void Reset() { BallObject = null; }