private void SetSnapDropZone() { if (sdz == null) { sdz = GetComponent <VRTK_SnapDropZone>(); } }
public void OnObjectSnapped(object sender, SnapDropZoneEventArgs e) { TableData d = (TableData)data.data.GetValue(); VRTK_SnapDropZone dropZone = ((VRTK_SnapDropZone)sender); SceneGameObjectReference sor = new SceneGameObjectReference(e.snappedObject.gameObject.GetComponentInChildren <SceneGameObject>()); if (dropZone.gameObject.name == "slot00") { d.slot00 = sor; } if (dropZone.gameObject.name == "slot01") { d.slot01 = sor; } if (dropZone.gameObject.name == "slot02") { d.slot02 = sor; } if (dropZone.gameObject.name == "slot03") { d.slot03 = sor; } if (dropZone.gameObject.name == "slot04") { d.slot04 = sor; } data.data.SetValue(d); }
// Start is called before the first frame update void Start() { backgroundRenderer = transform.GetChild(2).GetComponent <Renderer>(); startingColor = backgroundRenderer.material.color; dropZone = GetComponentInChildren <VRTK_SnapDropZone>(); dropZone.ObjectSnappedToDropZone += new SnapDropZoneEventHandler(ObjectSnappedInto); }
protected virtual void OnEnable() { fanvilRef = FindObjectOfType <Fanvil>(); toggleZoneA = GetComponent <VRTK_SnapDropZone>(); toggleZoneA.ObjectSnappedToDropZone += OnSnap; toggleZoneA.ObjectUnsnappedFromDropZone += OnUnSnap; }
void OnEnable() { // Search within gramophone's children for SnapDropZone object. if (snapDropZoneTransform == null) { snapDropZoneTransform = gameObject.transform.Find("SnapDropZone"); // If we didn't find it, return. if (snapDropZoneTransform == null) { return; } } // If we don't have them yet, access required components. if (snapDropZone == null) { snapDropZone = snapDropZoneTransform.GetComponent <VRTK_SnapDropZone>(); } if (audioSource == null) { audioSource = gameObject.GetComponent <AudioSource>(); } // Register our delegate functions. snapDropZone.ObjectSnappedToDropZone += DiskSnappedToDropZone; snapDropZone.ObjectUnsnappedFromDropZone += DiskUnsnappedFromDropZone; }
protected virtual void OnEnable() { runeMixerRef = FindObjectOfType <RuneMaker>(); toggleZoneA = GetComponent <VRTK_SnapDropZone>(); toggleZoneA.ObjectSnappedToDropZone += OnSnap; toggleZoneA.ObjectUnsnappedFromDropZone += OnUnSnap; }
private void Start() { snapdropScript = GetComponent <VRTK_SnapDropZone>(); snapdropScript.ObjectSnappedToDropZone += new SnapDropZoneEventHandler(OnCupSnapped); anim = fullClothingBody.GetComponent <Animator>(); drinkEventScript = fullClothingBody.GetComponent <DrinkEvents>(); }
void Start() { snap = transform.GetChild(0).GetComponent <VRTK_SnapDropZone>(); snap.ObjectSnappedToDropZone += OnSnapHandler; snap.ObjectUnsnappedFromDropZone += OnUnsnapHandler; }
void Start() { ShaftTopZone = GetComponent <VRTK_SnapDropZone>(); TopShaftHatch = GameObject.Find("GateShaftEnd").GetComponent <Animator>(); notOpen = true; SecondShaftKeyCard = GameObject.Find("ShaftKey").GetComponent <SkeletonKey>(); DamagedKeyCardSound = GetComponent <AudioSource>(); }
private void Start() { snapZone = GetComponent <VRTK_SnapDropZone>(); if (snapZone != null) { snapZone.ObjectSnappedToDropZone += SnapZone_ObjectSnappedToDropZone; } }
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; }
protected virtual void OnEnable() { theZone = (theZone == null ? GetComponent <VRTK_SnapDropZone>() : theZone); theAnimator = GetComponent <Animator>(); theZone.ObjectSnappedToDropZone += OnSnap; theZone.ObjectUnsnappedFromDropZone += OnUnsnap; }
void Start() { OpenBoxSnap = GetComponent <VRTK_SnapDropZone>(); Marker = GameObject.Find("Marker"); MarkerReleaseButton = GameObject.Find("MarkerReleaseButton").GetComponent <VRTK_PhysicsPusher>(); markerCanSnap = true; }
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); } }
void Start() { //PlayKeyAnimation(); if (Door) { keyDropZone = Door.GetComponentInChildren <VRTK_SnapDropZone>(); keyDropZone.ObjectSnappedToDropZone += KeySnappedToDropZone; } }
void Start() { notWaited = true; SwitchAnim = GetComponent <Animator>(); SwitchSnap = GameObject.Find("SwitchBoxSnapZone").GetComponent <VRTK_SnapDropZone>(); metallicBroom = false; metallicBroomParts = 0; BroomBreaksSound = GameObject.Find("BroomBreaksSound").GetComponent <AudioSource>(); BroomOpensLockerSound = GameObject.Find("BroomOpensLockerSound").GetComponent <AudioSource>(); }
/// <summary> /// Checks if the snap zone is in the correct order of objects to be unsnapped /// If it the dinner plate has not been filled with all the necessary objects: /// if it is beneath the highest object in the stack, do not allow unsnapping of the object /// else if the dinner plate has been filled with all the necessary objects: /// if it is in the wrong unsnap order, do not allow unsnapping of the object /// </summary> /// <param name="sz"></param> /// <returns>true, false</returns> public bool IsValidSnapZone(VRTK_SnapDropZone sz) { //if the snap zone is not at the top of the stack //i.e. it is not the last object in the array (same as snapCount), //Do not allow the object to be unsnapped if (snapCount == sz.proceduralSnapPos) { return(true); } return(false); }
private void Start() { originalTransform = transform; dropZone = GetComponent <VRTK_SnapDropZone>(); dropZone.ObjectEnteredSnapDropZone += DropZone_ObjectEnteredSnapDropZone; dropZone.ObjectExitedSnapDropZone += DropZone_ObjectExitedSnapDropZone; dropZone.ObjectSnappedToDropZone += DropZone_ObjectSnappedToDropZone; ParentTileObject = GameObject.FindGameObjectWithTag("TileParentObject"); TimerAndPoints = GameObject.FindGameObjectWithTag("TimeAndPoints"); Audio = GetComponent <AudioSource>(); }
private void DropZone_ObjectSnappedToDropZone(object sender, SnapDropZoneEventArgs e) { foreach (var hint in GameObject.FindGameObjectsWithTag("Hint")) { hint.SetActive(false); } VRTK_SnapDropZone dropZone = GetComponent <VRTK_SnapDropZone>(); dropZone.ObjectSnappedToDropZone -= DropZone_ObjectSnappedToDropZone; GetComponentInParent <MoveTiles>().StartLerping(); GameObject.FindGameObjectWithTag("TimeAndPoints").GetComponent <Timer>().StartTimer(); }
void Start() { WallCrack = GetComponent <VRTK_SnapDropZone>(); JuhaniHeadCollider1 = GameObject.Find("JuhaniClimbableHeadCollider1"); JuhaniHeadCollider2 = GameObject.Find("JuhaniClimbableHeadCollider2"); JuhaniMouthCollider = GameObject.Find("JuhaniUnClimbableMouthCollider"); JuhaniClimbableHeadset = GameObject.Find("JuhaniHeadClimbableHeadset"); ToxicGasLeak = GameObject.Find("ToxicGasLeak"); ToxicGas = ToxicGasLeak.GetComponent <ParticleSystem>(); ToxicGasMouth = GameObject.Find("ToxicGasLeakMouth").GetComponent <ParticleSystem>(); ToxicGasUnderWater = GameObject.Find("ToxicGasLeakUnderWater").GetComponent <ParticleSystem>(); notDone = true; }
// Start is called before the first frame update void Start() { backgroundRenderer = transform.GetChild(2).GetComponent <Renderer>(); startingColor = backgroundRenderer.material.color; textBox = GetComponentInChildren <TextMeshPro>(); dropZone = GetComponentInChildren <VRTK_SnapDropZone>(); dropZone.ObjectSnappedToDropZone += new SnapDropZoneEventHandler(ObjectSnappedInto); typeIndex = 0; textBox.text = typeInfos[typeIndex].text; }
void Start() { LeftHandColliders = VRTK_DeviceFinder.GetControllerLeftHand().gameObject.transform.GetChild(0).GetChild(2).gameObject; RightHandColliders = VRTK_DeviceFinder.GetControllerRightHand().gameObject.transform.GetChild(0).GetChild(2).gameObject; backpack = gameObject.AddComponent <BoxCollider>(); backpack.size = new Vector3(2.303633f, 2.189791f, 0.4338804f); backpack.center = new Vector3(0.02300131f, -0.2983266f, -0.05426104f); backpack.isTrigger = true; backZone = gameObject.GetComponent <VRTK_SnapDropZone>(); backpackFull = false; lefthandEntered = false; righthandEntered = false; notDisabled = true; }
private void Start() { cubeZone = transform.Find("Cube_SnapDropZone").gameObject.GetComponent <VRTK_SnapDropZone>(); sphereZone = transform.Find("Sphere_SnapDropZone").GetComponent <VRTK_SnapDropZone>(); cubeZone.ObjectEnteredSnapDropZone += new SnapDropZoneEventHandler(DoCubeZoneSnapped); cubeZone.ObjectSnappedToDropZone += new SnapDropZoneEventHandler(DoCubeZoneSnapped); cubeZone.ObjectExitedSnapDropZone += new SnapDropZoneEventHandler(DoCubeZoneUnsnapped); cubeZone.ObjectUnsnappedFromDropZone += new SnapDropZoneEventHandler(DoCubeZoneUnsnapped); sphereZone.ObjectEnteredSnapDropZone += new SnapDropZoneEventHandler(DoSphereZoneSnapped); sphereZone.ObjectSnappedToDropZone += new SnapDropZoneEventHandler(DoSphereZoneSnapped); sphereZone.ObjectExitedSnapDropZone += new SnapDropZoneEventHandler(DoSphereZoneUnsnapped); sphereZone.ObjectUnsnappedFromDropZone += new SnapDropZoneEventHandler(DoSphereZoneUnsnapped); }
void OnEnable() { io.InteractableObjectSnappedToDropZone += HandleSnappedToDropZone; io.InteractableObjectUnsnappedFromDropZone += HandleUnsnappedFromDropZone; if (io.IsInSnapDropZone()) { dropZone = io.GetStoredSnapDropZone(); dropZoneNetRef = NetworkReference.FromTransform(dropZone.transform); } else { dropZone = null; dropZoneNetRef = NetworkReference.INVALID; } }
private void RegisterModem(GameObject spawnedObject) { if (!gameObject.activeSelf) { return; } VRTK_SnapDropZone modemConnector = spawnedObject.GetComponentInChildren <VRTK_SnapDropZone>(true); Modem = spawnedObject; modemConnector.gameObject.SetActive(true); if (modemConnector != null) { modemConnector.ObjectSnappedToDropZone += ModemInstallationManager_ObjectSnappedToDropZone; modemConnector.ObjectUnsnappedFromDropZone += ModemInstallationManager_ObjectUnsnappedFromDropZone; } }
protected void Awake() { PlierZone = GetComponentInChildren <VRTK_SnapDropZone>(); RightController = GameObject.Find("RightController"); LeftController = GameObject.Find("LeftController"); beingReleased = false; BroomCollider1 = transform.Find("BroomCollider1").GetComponent <MeshCollider>(); BroomCollider2 = transform.Find("BroomCollider2").GetComponent <MeshCollider>(); BroomCollider3 = transform.Find("BroomCollider3").GetComponent <MeshCollider>(); BroomCollider4 = transform.Find("BroomCollider4").GetComponent <MeshCollider>(); BroomCollider5 = transform.Find("BroomCollider5").GetComponent <MeshCollider>(); BroomCollider6 = transform.Find("BroomCollider6").GetComponent <MeshCollider>(); BroomCollider7 = transform.Find("BroomCollider7").GetComponent <MeshCollider>(); BroomCollider8 = transform.Find("BroomCollider8").GetComponent <MeshCollider>(); PliersBody = gameObject.GetComponent <Rigidbody>(); ProperMass = PliersBody.centerOfMass; }
private void Start() { modemPlaceZone = GetComponentInChildren <VRTK_SnapDropZone>(); if (m_spawanInHand == null) { m_spawanInHand = FindObjectOfType <InventorySpawnInHand>(); } modemPlaceZone.gameObject.SetActive(false); m_spawanInHand.ModemSpawn += RegisterModem; EventCenter.AddListener(m_ActivateStep, ActivateSection); //EventCenter.AddListener(m_ActivateStep, RegisterCableSnapZone); if (modemPlaceZone != null) { modemPlaceZone.ObjectSnappedToDropZone += ModemSnaptoZone; modemPlaceZone.ObjectUnsnappedFromDropZone += ModemUnSnaptoZone; } gameObject.SetActive(false); }
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); } } } }
// Use this for initialization void Start() { // Set jack name gameObject.name = "Jack_" + Id; if (!Board) { GameObject goBoard = GameObject.Find("switchboard"); Switchboard brd = goBoard.GetComponent <Switchboard>(); if (brd) { _board = brd; } } _board.RegisterJack(this); _lightControl = GetComponent <LightController>(); _audioSource = GetComponent <AudioSource>(); // Subscribe to snapzone events _snapDropZone = GetComponentInChildren <VRTK_SnapDropZone>(); _snapDropZone.ObjectSnappedToDropZone += new SnapDropZoneEventHandler(OnSnap); _snapDropZone.ObjectUnsnappedFromDropZone += new SnapDropZoneEventHandler(OnUnsnap); }
private void ApplyState() { if (dropZoneNetRef == NetworkReference.INVALID) { if (io.IsInSnapDropZone()) { dropZone.ForceUnsnap(); dropZone = null; } } else { GameObject dzobj = dropZoneNetRef.FindObject(); if (dzobj != null) { VRTK_SnapDropZone newDropZone = dzobj.GetComponent <VRTK_SnapDropZone>(); if (newDropZone != null) { if (newDropZone != dropZone) { if (dropZone != null) { dropZone.ForceUnsnap(); } newDropZone.ForceSnap(io.gameObject); dropZone = newDropZone; } } else { Debug.LogError("DropZoneNetRef doesn't have a VRTK_SnapDropZone: " + dropZoneNetRef); } } else { Debug.LogError("Couldn't find DropZoneNetRef: " + dropZoneNetRef); } } }