void OnIsoTriggerEnter(IsoCollider other) { if (other.tag == "PromptLocation") { isCollided = true; } }
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); } }
void OnIsoTriggerExit(IsoCollider other) { if (other.tag == "PromptLocation") { isCollided = false; } }
void OnIsoTriggerExit(IsoCollider collider) { if (_action != null && _started) { _action.DoIsoTriggerExit(collider); } }
public override void DoIsoTriggerExit(IsoCollider collider) { if (triggerType == IsoTriggerType.IsoTriggerExit) { DoAction(collider); } }
void OnIsoTriggerEnter(IsoCollider other) { if (other.tag == "TangibleCollider") { tangibleDown = true; tempColliderObject = other; if (CheckPuckIndex(other) && locationOpen) { StartConstruction(other); } else if (!CheckPuckIndex(other)) { //Destroy(childObject); StartConstruction(other); } else { //prompt.showIncorrect(); StartConstruction(other); } } else { Debug.Log(other); } }
/** * 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); } }
public IsoRaycastHit(IsoCollider collider, float distance, Vector3 normal, Vector3 point, IsoRigidbody isoRigidbody, IsoTransform isoTransform) { Collider = collider; Distance = distance; Normal = normal; Point = point; IsoRigidbody = isoRigidbody; IsoTransform = isoTransform; }
/** * Detect iso trigger collisions */ void OnIsoTriggerEnter(IsoCollider isoCollider) { CivilCarAgent collidedCar = isoCollider.GetComponentInParent <CivilCarAgent>(); if (collidedCar != null) // If the car has collided with another car { if (collidedCar.notPassable) // And the car is a wall { StopMoving(); } } }
void StartConstruction(IsoCollider other) { Debug.Log(other.gameObject); Debug.Log("otherinfo added" + otherIndex); //turn on construction animation constructionObject.SetActive(true); //hide mainprompt prompt.hideAll(); tile = tiles[otherIndex]; Debug.Log(otherIndex); locationObject.SetActive(false); }
void DoAction(IsoCollider collider) { var go = Fsm.GetOwnerDefaultTarget(gameObject); if (UpdateCache(go)) { if (collider.gameObject.tag == collideTag.Value) { storeIsoCollider.Value = collider.gameObject; Fsm.Event(sendEvent); } } }
//separate function from ontriggerexit because collider destroy does not fire exit void OnPuckExit(GameObject newTile) { Debug.Log("puckExit!"); Destroy(childObject); childObject = Instantiate(newTile, gameObject.transform); constructionObject.SetActive(false); locationObject.SetActive(false); childObject.SetActive(true); IsoObject childIso = childObject.GetComponent <IsoObject>(); childIso.position = gameObject.GetComponent <IsoObject>().position; ModifyHealth health = childObject.GetComponent <ModifyHealth>(); //display nothing after prompt.hideAll(); tempColliderObject = null; }
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); }
public void Init(IsoCollider iso_collider) { _isoCollider = iso_collider; }
void OnIsoTriggerEnter(IsoCollider other) { Debug.Log("object collided"); Destroy(other.gameObject); }
void OnIsoTriggerExit(IsoCollider isoCollider) { Debug.Log(gameObject.name + " exits trigger with " + isoCollider.gameObject.name + ", awesome!"); }
void OnIsoTriggerStay(IsoCollider isoCollider) { Debug.Log(gameObject.name + " stays on trigger with " + isoCollider.gameObject.name + ", awesome!"); }
public virtual void DoIsoTriggerExit(IsoCollider collider) { }
public IsoFakeCollider Init(IsoCollider iso_collider) { _isoCollider = iso_collider; return(this); }
// Update is called once per frame void FixedUpdate() { // give a small gap before dragging, preventing that when user clicks on the DraggableIsoItem, the mouse is // also firing at the IsoDropZone besides it, causing the block to be shifted to the drag zone beside if (_dragging && Time.time - lastClickTime > 0.1f) { // fire a ray cast from the current mouse position to the Isometric dimension system var isoRay = Isometric.MouseToIsoRay(); IsoRaycastHit isoRaycastHit; if (IsoPhysics.Raycast(isoRay, out isoRaycastHit)) { // if the ray cast hits something, check which tile is it hitting, trigger entering the drop zone // and exiting the previous drop zone var hitCollider = isoRaycastHit.Collider; if (hitCollider != _currentHitCollider) { // if the ray cast did not hit any tile, the block is moved to an empty space, trigger exiting the // previous drop zone if (_currentHitCollider != null) { OnIsoTriggerExitDZ(_currentHitCollider); } OnIsoTriggerEnterDZ(hitCollider); _currentHitCollider = hitCollider; } } else { if (_currentHitCollider != null) // The block is leaving the drop zone { OnIsoTriggerExitDZ(_currentHitCollider); _currentHitCollider = null; } } // Move the block visually var localMousePos = Input.mousePosition; var mousePosWorld = Camera.main.ScreenToWorldPoint(new Vector3(localMousePos.x, localMousePos.y, Camera.main.nearClipPlane)); var diff = mousePosWorld - _prevMousePos; GetComponent <IsoTransform>().transform.Translate(diff); if (dropZone != null) { dropZone.OnItemDrag(this); } _prevMousePos = mousePosWorld; } if (_moving) // The block is moving to its new drop zone { _civilLevelController.ToggleGameControlButtons(false); transform.position = Vector3.Lerp(transform.position, _target, 0.1f); // Transform the position with an animation if (Vector3.Distance(transform.position, _target) < 0.01f) { // Actually move the block there GetComponent <IsoTransform>().Position = dropZone.GetComponent <IsoTransform>().Position; _civilLevelController.ToggleGameControlButtons(true); _moving = false; } } }
// 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; }
void OnIsoTriggerEnter(IsoCollider iso_collider) { Debug.LogFormat( "OnIsoTriggerEnter. self:{0} other:{1}", gameObject.name, iso_collider.gameObject.name); }
public virtual void DoIsoTriggerEnter(IsoCollider collider) { }