/** * Block has exited the drop zone */ void OnIsoTriggerExitDZ(IsoCollider col) { if (!_dragging) { return; } var possibleDropZone = col.GetComponent <IsoDropZone>(); if (possibleDropZone == null) { return; } var prevIndex = _newDropZones.IndexOf(possibleDropZone); if (prevIndex > -1) // Previous drop zone { _newDropZones[prevIndex].OnDragExit(this); _newDropZones.RemoveAt(prevIndex); if (prevIndex == 0 && _newDropZones.Count > 0) { _newDropZones[0].OnDragEnter(this); } } else if (possibleDropZone == dropZone) { dropZone.OnDragExit(this); } }
void OnIsoTriggerExit(IsoCollider other) { //functionality for initial puck placement if (other.tag == "TangibleCollider") { tangibleDown = false; if (CheckPuckIndex(other) && timerEnd) { //build new tile OnPuckExit(tiles[other.GetComponent <TangibleCollider>().tileIndex]); } else if (!childObject) { ResetPromptLocation(); } else if (!CheckPuckIndex(other) && childObject) //delete if puck is delete puck { ResetPromptLocation(); } else { prompt.hideAll(); constructionObject.SetActive(false); } } else { Debug.Log(other); } }
bool CheckPuckIndex(IsoCollider other) { bool notDelete; int index = other.GetComponent <TangibleCollider>().tileIndex; if (index < tiles.Length) { notDelete = true; } else { //if out of range of tiles array the puck must be 'delete' notDelete = false; } return(notDelete); }
/** * Block has entered the drop zone */ void OnIsoTriggerEnterDZ(IsoCollider col) { if (!_dragging) { return; // No block being held } var possibleDropZone = col.GetComponent <IsoDropZone>(); if (possibleDropZone == null) { return; // No drop zone } foreach (var dropZone in _newDropZones) { dropZone.OnDragExit(this); } _newDropZones.Insert(0, possibleDropZone); _newDropZones[0].OnDragEnter(this); }
// Update is called once per frame void Update() { //Debug.Log("otherinfo " + otherObjectInfo+", "+"tempCollider " + otherObjectInfo); //if we have info from collision enter but the object is set to inactive if (tempColliderObject) { //Debug.Log("tempCollider exists!"); if (!tempColliderObject.gameObject.activeSelf) { Debug.Log("puck lifted"); tangibleDown = false; if (CheckPuckIndex(tempColliderObject) && timerEnd) { OnPuckExit(tiles[tempColliderObject.GetComponent <TangibleCollider>().tileIndex]); //OnPuckExit(tile); tempColliderObject = null; } else if (!childObject) { ResetPromptLocation(); } else if (!CheckPuckIndex(tempColliderObject) && childObject) //delete if timer is out at puck is delete puck { ResetPromptLocation(); } else { prompt.hideAll(); constructionObject.SetActive(false); } } } //if (prompt && childObject) //if childObject is active and prompt is present set location open to false //{ // locationOpen = false; //} if (tangibleDown && !timerEnd) //if tangible is placed but timer has not ended { //decrease timer when tangible is in place targetTime -= Time.deltaTime; } else if (!tangibleDown) //if tangible is not placed { ResetTimer(); } if (targetTime <= 0.0f) { timerEnded(); } //disabled for free play //if (!prompt) //{ // iso.enabled = false; //} //else //{ // iso.enabled = true; //} iso.enabled = true; }