public void Clear() { foreach (PatchBody patchBody in PatchBodies) { Destroy(patchBody.gameObject); } PatchBodies.Clear(); }
public void Delete() { if (PatchBody != null) { PatchBodies.Remove(PatchBody); MainManager.GetInstance().Delete(PatchBody.Patch); WireDrawer.GetInstance().RemovePatch(PatchBody); Destroy(PatchBody.gameObject); PatchBody = null; } }
public void Load(Patch[] patches) { foreach (Patch patch in patches) { PatchBody patchBodyPrefab = null; foreach (PatchBody prefab in patchBodiesPrefabs) { if (prefab.name == patch.Code) { patchBodyPrefab = prefab; } } Vector3 position = new Vector3(patch.PosX, patch.PosY, 0); PatchBody = Instantiate(patchBodyPrefab, position, Quaternion.identity); PatchBody.Patch = patch; PatchBody.PatchCreator = this; PatchBody.transform.parent = patchBodyHolder.transform; PatchBodies.Add(PatchBody); } }
public void CreatePatchBody(string patchCode) { PatchBody patchBodyPrefab = null; foreach (PatchBody prefab in patchBodiesPrefabs) { if (prefab.name == patchCode) { patchBodyPrefab = prefab; } } Vector3 position = InputHandler.GetTouchPosition(); PatchBody = Instantiate(patchBodyPrefab, position, Quaternion.identity); PatchBody.Patch = MainManager.GetInstance().CreatePatch(patchCode); PatchBody.Patch.PosX = position.x; PatchBody.Patch.PosY = position.y; PatchBody.PatchCreator = this; PatchBody.transform.parent = patchBodyHolder.transform; PatchBodies.Add(PatchBody); }