public void Ready(PlaceableGameObject placeableGO) { //Sets up to accept it hoverZoneCollider.enabled = true; //Trigger some sort of cosmetic change? }
void OnPlaceableGODropped(PlaceableGameObject placeableGO) { foreach (Slot slot in slots) { slot.UnReady(placeableGO); } }
public void OnPlaceableGOPickedUp(PlaceableGameObject placeableGO) { bool conditionSatisfied = condition.Evaluate(placeableGO.placeable); if (conditionSatisfied) { hoverZoneCollider.enabled = true; isAcceptablePlaceablePickedUp = true; } }
void OnPlaceableGOPickedUp(PlaceableGameObject placeableGO) { //Forwards the event to the next slot, if any foreach (Slot slot in slots) { if (slot.IsEmpty()) { slot.Ready(placeableGO); return; } } }
public bool Remove(PlaceableGameObject placeableGO) { if (placeableGO == contents) { contents.transform.parent = null; contents = null; return(true); } else { return(false); } }
private void OnMouseUp() { isBeingDragged = false; dragged = null; OnDropped?.Invoke(this); if (placementLocationQueue.Count == 0 || !placementLocationQueue[0].CanBePlaced(this)) //If it can't be placed where it is, either due to being off-screen or over an unacceptable location { currentPlacementLocation.PlaceBack(this); //Place it back where it was, even if it's an unacceptable place } else { placementLocationQueue[0].Place(this); currentPlacementLocation = placementLocationQueue[0]; } placementLocationQueue = new List <IPlacementLocation>(); //Resets the queue }
private void OnMouseDown() { if (isLocked) { return; } isBeingDragged = true; if (dragged == null) { dragged = this; } else { throw new System.Exception("Error: Multiple PlaceableGameObjects are being dragged at once: '" + name + "' and '" + dragged.name + "'"); } currentPlacementLocation?.Remove(this); transform.parent = null; //if (currentPlacementLocation != null) placementLocationQueue.Add(currentPlacementLocation); OnPickedUp?.Invoke(this); }
public bool CanBePlaced(PlaceableGameObject placeableGO) { return(condition.Evaluate(placeableGO.placeable)); }
public void PlaceBack(PlaceableGameObject placeableGO) { Place(placeableGO); }
public void Place(PlaceableGameObject placeableGO) { placeableGO.transform.parent = transform; placeableGO.transform.localPosition = contentsPosition; contents = placeableGO; }
public void PlaceBack(PlaceableGameObject placed) { contents.Add(placed); placed.transform.position = justRemovedPosition; }
/*private void OnTriggerEnter(Collider other) * { * //Don't do anything if the other wasn't the thing being dragged * PlaceableGameObject otherPlaceableGO = other.GetComponent<PlaceableGameObject>(); * if(otherPlaceableGO == null || otherPlaceableGO != PlaceableGameObject.dragged) * { * return; * } * * if (isAcceptablePlaceablePickedUp) * { * otherPlaceableGO.Accept(this); * } * isDraggedHovering = true; * } * * private void OnTriggerExit(Collider other) * { * //Don't do anything if the other wasn't the thing being dragged * PlaceableGameObject otherPlaceableGO = other.GetComponent<PlaceableGameObject>(); * if (otherPlaceableGO == null || otherPlaceableGO != PlaceableGameObject.dragged) * { * return; * } * * otherPlaceableGO.Unaccept(this); * isDraggedHovering = false; * }*/ public void OnPlaceableGODropped(PlaceableGameObject placeableGO) { isAcceptablePlaceablePickedUp = false; hoverZoneCollider.enabled = false; }
public bool CanBePlaced(PlaceableGameObject placeableGO) { return(false); }
public void OnPlaceableGODropped(PlaceableGameObject placeableGO) { zoneCollider.enabled = false; }
public void OnPlaceableGOPickedUp(PlaceableGameObject placeableGO) { zoneCollider.enabled = true; }
public bool Remove(PlaceableGameObject placeableGO) { return(false); }
public void PlaceBack(PlaceableGameObject placeableGO) { throw new System.Exception("Tried to place back object '" + placeableGO.name + "' into ExclusionZone '" + name + "'"); }
public bool Remove(PlaceableGameObject removed) { justRemovedPosition = removed.transform.position; //removed.transform.parent = null; return(contents.Remove(removed)); }
public void UnReady(PlaceableGameObject placeableGO) { hoverZoneCollider.enabled = false; }
public void Place(PlaceableGameObject placed) { contents.Add(placed); placed.transform.parent = transform; placed.transform.position = new Vector3(placed.transform.position.x, tableHeight, placed.transform.position.z); }