private void SnapAt(ProgramBlock block, int newZoneIndex) { VRTK_SnapDropZone nextVrtkZone = _zones[newZoneIndex].GetComponent <VRTK_SnapDropZone>(); nextVrtkZone.ForceSnap(block.gameObject); block.ZoneId = nextVrtkZone.GetComponent <SnapDropZone>().ZoneId; }
private void DoProgramBlockZoneExited(object sender, SnapDropZoneEventArgs e) { Debug.Log("== SnapDropZone: EXITED >>>>"); if (sender is VRTK_SnapDropZone) { VRTK_SnapDropZone originZone = (VRTK_SnapDropZone)sender; DecreaseZoneHeight(originZone.GetComponent <SnapDropZone>().ZoneId); } }
private void DoProgramBlockZoneSnapped(object sender, SnapDropZoneEventArgs e) { //Debug.Log("== SnapDropZone: SNAPPED >>>> [ ] <<<<"); if (sender is VRTK_SnapDropZone) { VRTK_SnapDropZone originZone = (VRTK_SnapDropZone)sender; int zoneId = originZone.GetComponent <SnapDropZone>().ZoneId; DecreaseZoneHeight(zoneId); Destroy(GetTemporaryPositionObjectByZoneId(zoneId)); ProgramBlock block = GetProgramBlockByObject(GetGameObjectBySnapIndex(zoneId)); //Debug.Log("== SnapDropZone: SNAPPED block state = " + block.State.ToString()); if (block.State != State.SnapTempMove) { if (IsPreviousZoneEmpty(zoneId)) { MoveSnappedBlock(zoneId, zoneId - 1, false); } } } }
private void SetSnapDropZoneActive(bool active) { //snapDropZone.gameObject.SetActive(active); snapDropZone.GetComponent <Collider>().enabled = snapDropZoneActive & active; }
//Checks what object if any is snapped to the research table snap zone(s) currently public void CheckResearchTable() { if (ResearchSnapZoneOpenBox.GetCurrentSnappedObject() != null) { if (ResearchSnapZoneOpenBox.GetCurrentSnappedObject() == OpenBox) { currentTableObject = "OpenBox"; //so that cannot snap multiple objects at the same time ResearchSnapZoneConveyor.GetComponent <Collider>().enabled = false; ResearchSnapZonePool.GetComponent <Collider>().enabled = false; ResearchSnapZoneSiren.GetComponent <Collider>().enabled = false; } } else if (ResearchSnapZoneConveyor.GetCurrentSnappedObject() != null) { if (ResearchSnapZoneConveyor.GetCurrentSnappedObject() == ConveyorBelt) { Debug.Log("Conveyorsnap"); currentTableObject = "ConveyorBelt"; ResearchSnapZoneOpenBox.GetComponent <Collider>().enabled = false; ResearchSnapZonePool.GetComponent <Collider>().enabled = false; ResearchSnapZoneSiren.GetComponent <Collider>().enabled = false; } } else if (ResearchSnapZonePool.GetCurrentSnappedObject() != null) { if (ResearchSnapZonePool.GetCurrentSnappedObject() == ResearchPool) { currentTableObject = "Pool"; ResearchSnapZoneConveyor.GetComponent <Collider>().enabled = false; ResearchSnapZoneOpenBox.GetComponent <Collider>().enabled = false; ResearchSnapZoneSiren.GetComponent <Collider>().enabled = false; } } else if (ResearchSnapZoneSiren.GetCurrentSnappedObject() != null) { if (ResearchSnapZoneSiren.GetCurrentSnappedObject() == Siren) { currentTableObject = "Siren"; ResearchSnapZoneConveyor.GetComponent <Collider>().enabled = false; ResearchSnapZonePool.GetComponent <Collider>().enabled = false; ResearchSnapZoneOpenBox.GetComponent <Collider>().enabled = false; } } else { currentTableObject = null; ResearchSnapZoneConveyor.GetComponent <Collider>().enabled = true; ResearchSnapZonePool.GetComponent <Collider>().enabled = true; ResearchSnapZoneSiren.GetComponent <Collider>().enabled = true; ResearchSnapZoneOpenBox.GetComponent <Collider>().enabled = true; } //enables the attention button in order to play hologram and get code if (!hologramInProgress && !octoAnimInProgress && combinationNumber == 0) { if (currentTableObject == "OpenBox" && currentMarkedLocation == "OpenBox") { OctopusAttentionButtonMeshMaterial.material.SetColor("_EmissionColor", Color.red * 1f); OctopusAttention.stayPressed = true; if (OctopusAttention.AtMaxLimit() && OctopusAttention.stayPressed) { OctopusAttention.stayPressed = false; OctopusAttentionButtonMeshMaterial.material.SetColor("_EmissionColor", Color.red * 0f); AnimateHologram("OpenBox"); AnimateOctopus("OCTO_CLOSE"); DisplayCode("CLOSE"); } } else if (currentTableObject == "ConveyorBelt" && currentMarkedLocation == "ConveyorBelt") { Debug.Log("conveyor"); OctopusAttentionButtonMeshMaterial.material.SetColor("_EmissionColor", Color.red * 1f); OctopusAttention.stayPressed = true; if (OctopusAttention.AtMaxLimit() && OctopusAttention.stayPressed) { OctopusAttention.stayPressed = false; OctopusAttentionButtonMeshMaterial.material.SetColor("_EmissionColor", Color.red * 0f); AnimateHologram("ConveyorBelt"); AnimateOctopus("OCTO_TURNON"); DisplayCode("ON"); } } else if (currentTableObject == "Pool" && currentMarkedLocation == "Pool") { Debug.Log("pool"); OctopusAttentionButtonMeshMaterial.material.SetColor("_EmissionColor", Color.red * 1f); OctopusAttention.stayPressed = true; if (OctopusAttention.AtMaxLimit() && OctopusAttention.stayPressed) { OctopusAttention.stayPressed = false; OctopusAttentionButtonMeshMaterial.material.SetColor("_EmissionColor", Color.red * 0f); AnimateHologram("Pool"); AnimateOctopus("OCTO_LOWER"); DisplayCode("LOWER"); } } else if (currentTableObject == "Siren" && currentMarkedLocation == "Siren") { Debug.Log("siren"); OctopusAttentionButtonMeshMaterial.material.SetColor("_EmissionColor", Color.red * 1f); OctopusAttention.stayPressed = true; if (OctopusAttention.AtMaxLimit() && OctopusAttention.stayPressed) { OctopusAttention.stayPressed = false; OctopusAttentionButtonMeshMaterial.material.SetColor("_EmissionColor", Color.red * 0f); AnimateHologram("Siren"); AnimateOctopus("OCTO_CLOSE"); DisplayCode("PLAY"); } } } }