Example #1
0
        public void HideLoot(LootState state)
        {
            var pooler = GetComponentInParent <BoardView>().cardPooler;

            for (int i = cards.Count - 1; i >= 0; i--)
            {
                var card = cards[i];
                cards.Remove(card);

                card.gameObject.SetActive(false);
                card.transform.localScale = Vector3.one;

                var poolable = card.GetComponent <Poolable>();
                pooler.Enqueue(poolable);
            }
        }
Example #2
0
    void PickingUp()
    {
        if (state == LootState.PickingUp)
        {
            timerPickUpTime += Time.deltaTime;
            float pickUpLerpFactor = timerPickUpTime / pickUpTime;
            transform.rotation = Quaternion.Slerp(idleRotation, hand.rotation, pickUpLerpFactor);

            transform.position = Vector3.Lerp(idlePosition, hand.position, pickUpLerpFactor);
            if (timerPickUpTime >= pickUpTime)
            {
                state           = LootState.InInventory;
                timerPickUpTime = 0;
            }
        }
    }
Example #3
0
        public void ShowLoot(LootState state)
        {
            var boardView = GetComponentInParent <BoardView>();

            lootSystem = state.Container.GetAspect <LootSystem>();

            for (int i = 0; i < lootSystem.loot.Count; i++)
            {
                var cardObj  = boardView.cardPooler.Dequeue().gameObject;
                var cardView = cardObj.GetComponent <CardView>();
                cardView.card = lootSystem.loot[i];
                cardView.Flip(true);
                cardView.transform.ResetParent(transform);
                cardView.transform.position   = transform.position + Vector3.right * ((i * 2f) - 2f);
                cardView.transform.rotation   = transform.rotation;
                cardView.transform.localScale = transform.localScale;
                cardView.gameObject.SetActive(true);
                cardObj.LoadAssets();

                cards.Add(cardView);
            }
        }
Example #4
0
 public void PickUp(Transform hand)
 {
     this.hand = hand;
     state     = LootState.PickingUp;
 }
Example #5
0
        private void LOOT_HANDLE(LootState parState)
        {
            switch (parState)
            {
            case LootState.SHOW:
                Action tmpAction = () =>
                {
                    thrLootUpdate = new Task(() =>
                    {
                        if (ObjectManager.Instance.Player.CurrentLootGuid == 0)
                        {
                            return;
                        }
                        if (LootFrame.IsOpen)
                        {
                            LootFrame.Destroy();
                        }
                        LootFrame.Create();
                    });
                    thrLootUpdate.ContinueWith(task =>
                    {
                        if (!LootFrame.IsOpen)
                        {
                            return;
                        }
#if OUTPUT
                        var frame = LootFrame.Instance;
                        Console.WriteLine("Looting: " + frame.LootGuid);
                        for (var i = 0; i < frame.LootCount; i++)
                        {
                            var res  = "";
                            var item = frame.Items[i];
                            if (item.IsCoin)
                            {
                                res += item.LootSlot + " COIN: " + frame.Coins;
                            }
                            else
                            {
                                res += item.LootSlot + " " + item.Quantity + "x " + item.Info.Name;
                            }
                            Console.WriteLine(res);
                        }
                        Console.WriteLine();
#endif
                        OnLootOpened?.Invoke(this, new EventArgs());
                    });
                    thrLootUpdate.Start();
                };
                if (thrLootUpdate != null && thrLootUpdate.Status == TaskStatus.Running)
                {
                    return;
                }
                MainThread.Instance.Invoke(tmpAction);
                break;

            case LootState.CLOSE:
                LootFrame.Destroy();
                thrLootUpdate = null;
                OnLootClosed?.Invoke(this, new EventArgs());
                break;
            }
        }