Пример #1
0
 private void PlaceObjectOnDesk(MovableObject obj)
 {
     obj.transform.position = _currentDeskSpawnPos;
     obj.Select();
     obj.Deselect();
     _currentDeskSpawnPos.y -= obj.ObjSpriteRenderer.bounds.size.y + 0.1f;
 }
Пример #2
0
 private void PlaceObjectInCenter(MovableObject obj)
 {
     obj.transform.position = _currentCenterSpawnPos;
     obj.Select();
     obj.Deselect();
     _currentCenterSpawnPos.x += obj.ObjSpriteRenderer.bounds.size.x + 0.1f;
 }
Пример #3
0
    private IEnumerator PlaceObjectInDrawer(MovableObject obj, DrawerTray tray)
    {
        DropZone_Drawer targetDrawer = null;

        if (_drawers == null)
        {
            _drawers = FindObjectsOfType <DropZone_Drawer>();

            if (_drawers == null)
            {
                yield return(null);
            }
        }

        if (_slidableDrawer == null)
        {
            _slidableDrawer = FindObjectOfType <SlidableDrawer>();
        }

        if (_slidableDrawer.drawerType == DrawerType.Solo)
        {
            tray = DrawerTray.bottom;
        }

        foreach (var drawer in _drawers)
        {
            if (drawer.tray == tray)
            {
                targetDrawer = drawer;
                break;
            }
        }

        //Debug.Log(obj.gameObject.name + " placed in drawer : " + targetDrawer.gameObject.name);

        if (targetDrawer != null)
        {
            obj.transform.position = targetDrawer.GetRandomPointInZone();
            obj.Select(false);

            yield return(new WaitForFixedUpdate());

            obj.Deselect(false);
        }
    }
Пример #4
0
    private IEnumerator PlaceObjectInOutbox(MovableObject obj)
    {
        if (_outbox == null)
        {
            _outbox = FindObjectOfType <DropZone_Outbox>();

            if (_outbox == null)
            {
                yield return(null);
            }
        }
        obj.transform.position = _outbox.gameObject.transform.position;
        obj.Select(false);

        yield return(new WaitForFixedUpdate());

        obj.Deselect(false);

        if (newObjectInOutbox != null)
        {
            newObjectInOutbox();
        }
    }