Esempio n. 1
0
    public void Ready(PlaceableGameObject placeableGO)
    {
        //Sets up to accept it
        hoverZoneCollider.enabled = true;

        //Trigger some sort of cosmetic change?
    }
Esempio n. 2
0
 void OnPlaceableGODropped(PlaceableGameObject placeableGO)
 {
     foreach (Slot slot in slots)
     {
         slot.UnReady(placeableGO);
     }
 }
Esempio n. 3
0
    public void OnPlaceableGOPickedUp(PlaceableGameObject placeableGO)
    {
        bool conditionSatisfied = condition.Evaluate(placeableGO.placeable);

        if (conditionSatisfied)
        {
            hoverZoneCollider.enabled     = true;
            isAcceptablePlaceablePickedUp = true;
        }
    }
Esempio n. 4
0
 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;
         }
     }
 }
Esempio n. 5
0
    public bool Remove(PlaceableGameObject placeableGO)
    {
        if (placeableGO == contents)
        {
            contents.transform.parent = null;
            contents = null;

            return(true);
        }
        else
        {
            return(false);
        }
    }
Esempio n. 6
0
    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
    }
Esempio n. 7
0
    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);
    }
Esempio n. 8
0
 public bool CanBePlaced(PlaceableGameObject placeableGO)
 {
     return(condition.Evaluate(placeableGO.placeable));
 }
Esempio n. 9
0
 public void PlaceBack(PlaceableGameObject placeableGO)
 {
     Place(placeableGO);
 }
Esempio n. 10
0
 public void Place(PlaceableGameObject placeableGO)
 {
     placeableGO.transform.parent        = transform;
     placeableGO.transform.localPosition = contentsPosition;
     contents = placeableGO;
 }
Esempio n. 11
0
 public void PlaceBack(PlaceableGameObject placed)
 {
     contents.Add(placed);
     placed.transform.position = justRemovedPosition;
 }
Esempio n. 12
0
    /*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;
    }
Esempio n. 13
0
 public bool CanBePlaced(PlaceableGameObject placeableGO)
 {
     return(false);
 }
Esempio n. 14
0
 public void OnPlaceableGODropped(PlaceableGameObject placeableGO)
 {
     zoneCollider.enabled = false;
 }
Esempio n. 15
0
 public void OnPlaceableGOPickedUp(PlaceableGameObject placeableGO)
 {
     zoneCollider.enabled = true;
 }
Esempio n. 16
0
 public bool Remove(PlaceableGameObject placeableGO)
 {
     return(false);
 }
Esempio n. 17
0
 public void PlaceBack(PlaceableGameObject placeableGO)
 {
     throw new System.Exception("Tried to place back object '" + placeableGO.name + "' into ExclusionZone '" + name + "'");
 }
Esempio n. 18
0
 public bool Remove(PlaceableGameObject removed)
 {
     justRemovedPosition = removed.transform.position;
     //removed.transform.parent = null;
     return(contents.Remove(removed));
 }
Esempio n. 19
0
 public void UnReady(PlaceableGameObject placeableGO)
 {
     hoverZoneCollider.enabled = false;
 }
Esempio n. 20
0
 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);
 }