상속: strange.extensions.mediation.impl.View
        private void onHover(GameObject hoveredObject)
        {
            if (hoveredObject != null)
            {
                if (hoveredObject.CompareTag("Card"))
                {
                    var cardView = hoveredObject.GetComponent<CardView>();
                    if (cardView != null && cardView != lastHoveredCard && players.OpponentId(turns.currentPlayerId) != cardView.card.playerId )
                    {
                        //break out and don't hover if it hasn't been added to the hand of cards yet
                        if (!cards.Cards.Contains(cardView.card))
                        {
                            return;
                        }
                        lastHoveredCard = cardView;
                        cardHovered.Dispatch(cardView.card);

                    }
                }
            }
            else
            {
                if (lastHoveredCard != null)
                {
                    lastHoveredCard = null;
                    cardHovered.Dispatch(null);
                }
            }
        }
예제 #2
0
        internal void init()
        {
            var cardCanvas = GameObject.Find(Constants.cardCanvas);
            canvas = GameObject.Find("Canvas").gameObject.GetComponent<Canvas>();
            //set up fake card model
            var hoverCardModel = new CardModel()
            {
                playerId = -1,
            };

            //init the hover card that's hidden most of the time
            cardService.CreateCard(hoverCardModel, cardCanvas.transform, new Vector3(10000,10000, 0));
            var hoverCardGO = hoverCardModel.gameObject;

            hoverCardGO.name = hoverName;
            hoverCardGO.tag = "HoverCard";

            //disable all colliders so you can't hover the hover
            foreach (var collider in hoverCardGO.GetComponentsInChildren<BoxCollider>())
            {
                collider.enabled = false;
            }
            foreach (var collider in hoverCardGO.GetComponentsInChildren<MeshCollider>())
            {
                collider.enabled = false;
            }

            hoverCardView = hoverCardGO.AddComponent<CardView>();
            hoverCardView.card = hoverCardModel;

            hoverCardGO.SetActive(false);
        }