/// <summary> /// Paints the placeable. /// </summary> /// <param name="placeable">Placeable.</param> public Placeable PaintPlaceable(Placeable placeable) { float x = Mathf.Round(Camera.main.ScreenToWorldPoint(Input.mousePosition).x); float y = Mathf.Round(Camera.main.ScreenToWorldPoint(Input.mousePosition).y); Placeable newPlaceable = Instantiate(placeable, new Vector2(x, y), Quaternion.identity); newPlaceable.SetData(new PlaceableData(placeable.name)); CurrentLevel.levelData.AddPlaceableData(newPlaceable.pData); newPlaceable.gameObject.transform.SetParent(GameObject.FindGameObjectWithTag("placeable container").transform); newPlaceable.gameObject.name = placeable.gameObject.name + " " + newPlaceable.pData.ID; AnimatedObject animation = newPlaceable.gameObject.AddComponent <AnimatedObject> (); animation.SetData(newPlaceable.pData); OnPlaceablePainted(newPlaceable); return(newPlaceable); }