public override void HoldItem(SceneGameObject childOfElement, bool instancing = true) { MetallicBoxData metallicBoxData = (MetallicBoxData)data.data.GetDefaultValue(); childOfElement.gameObject.SetActive(true); var spawnPoint = CheckSpawnpointFit(childOfElement, true); if (spawnPoint != null) { if (instancing) { if (metallicBoxData.toolsList == null) { metallicBoxData.toolsList = new List <SceneGameObjectReference>(); } metallicBoxData.toolsList.Add(new SceneGameObjectReference(childOfElement)); data.data.SetDefaultValue(metallicBoxData); } childOfElement.transform.SetParent(spawnPoint); childOfElement.transform.localPosition = Vector3.zero; childOfElement.transform.localRotation = Quaternion.identity; // Evitar que los spawnpoint se muevan junto las herramientas childOfElement.transform.SetParent(this.gameObject.transform); } else { Debug.Log("Cannot place object with id " + childOfElement.data.id + " inside the container"); childOfElement.gameObject.SetActive(false); } }
public override bool CanHoldItem(SceneGameObject previewSGO) { MetallicBoxData metallicBoxData = (MetallicBoxData)data.data.GetValue(); Transform spawnPoint = CheckSpawnpointFit(previewSGO); bool freeSpace = spawnPoint != null; return(freeSpace && previewSGO is ITool); }