public void ClearMap() { foreach (var obstacle in dictionaryOfObstacles.Values) { Destroy(obstacle); } dictionaryOfObstacles.Clear(); if (animate) { DropTween.ResetTime(); } }
private void CreateIndicator(Vector3 position, GameObject prefab, Quaternion rotation = new Quaternion()) { var placementPosition = position + new Vector3(.5f, .5f, .5f); var element = Instantiate(prefab, placementPosition, rotation); element.transform.parent = parent; dictionaryOfObstacles.Add(position, element); if (animate) { element.AddComponent <DropTween>(); DropTween.IncreaseDropTime(); } }
private void CreateIndicator(Vector3 position, Color color, PrimitiveType sphere) { var element = GameObject.CreatePrimitive(sphere); dictionaryOfObstacles.Add(position, element); element.transform.position = position + new Vector3(.5f, .5f, .5f); element.transform.parent = parent; var renderer = element.GetComponent <Renderer>(); renderer.material.SetColor("_Color", color); if (animate) { element.AddComponent <DropTween>(); DropTween.IncreaseDropTime(); } }