예제 #1
0
 private void AutomaticallyOpenPack()
 {
     if (this.CanOpenPackAutomatically())
     {
         this.HideUnopenedPackTooltip();
         UnopenedPack pack = null;
         if (!this.m_unopenedPacks.TryGetValue(this.m_lastOpenedBoosterId, out pack) || (pack.GetBoosterStack().Count == 0))
         {
             foreach (KeyValuePair <int, UnopenedPack> pair in this.m_unopenedPacks)
             {
                 if ((pair.Value != null) && (pair.Value.GetBoosterStack().Count > 0))
                 {
                     pack = pair.Value;
                     break;
                 }
             }
         }
         if ((pack != null) && pack.CanOpenPack())
         {
             this.m_draggedPack = pack.AcquireDraggedPack();
             this.PickUpBooster();
             pack.StopAlert();
             this.OpenBooster(this.m_draggedPack);
             this.DestroyDraggedPack();
             this.UpdateUIEvents();
             this.m_DragPlane.SetActive(false);
         }
     }
 }
예제 #2
0
    private void CreateDraggedPack(UnopenedPack creatorPack)
    {
        RaycastHit hit;

        this.m_draggedPack = creatorPack.AcquireDraggedPack();
        Vector3 position = this.m_draggedPack.transform.position;

        if (UniversalInputManager.Get().GetInputHitInfo(GameLayer.DragPlane.LayerBit(), out hit))
        {
            position = hit.point;
        }
        float  f      = Vector3.Dot(Camera.main.transform.forward, Vector3.up);
        float  num2   = -f / Mathf.Abs(f);
        Bounds bounds = this.m_draggedPack.GetComponent <Collider>().bounds;

        position.y += (num2 * bounds.extents.y) * this.m_draggedPack.transform.lossyScale.y;
        this.m_draggedPack.transform.position = position;
    }