/// <summary> /// Instantiates Ore object on specific position with given parent /// </summary> /// <param name="orePrefab">prefab of ore being generated</param> /// <param name="x">first index of the oreArray</param> /// <param name="y">second index of the oreArray</param> /// <param name="parent">optional parent object of the new Ore object</param> /// <returns>Ore object of instantiated gameobject</returns> private Ore CreateOre(Ore orePrefab, int x, int y, GameObject parent = null) { GameObject oreObject = (GameObject)LeanTween.Instantiate(orePrefab.gameObject, initialPosition + new Vector3(x * orePrefab.Width, y * orePrefab.Height), orePrefab.transform.rotation); oreObject.name = orePrefab.Type.ToString() + " [" + (x + 1).ToString() + ", " + (y + 1).ToString() + "]"; if (parent != null) { oreObject.transform.parent = parent.transform; } Ore ore = oreObject.GetComponent <Ore>(); ore.SetGameController(this); ore.Init(); return(ore); }