コード例 #1
0
ファイル: Selected.cs プロジェクト: wiki111/KarciankaUnity
    public void LoadCard()
    {
        if (currentCard.Get() == null)
        {
            return;
        }

        currentCard.Get().gameObject.SetActive(false);
        cardViz.LoadCard(currentCard.Get().viz.card);
        cardViz.gameObject.SetActive(true);
    }
コード例 #2
0
    public override void Execute(float d)
    {
        bool mouseIsDown = Input.GetMouseButton(0);

        if (!mouseIsDown)
        {
            List <RaycastResult> results = Settings.GetUIObjects();
            foreach (RaycastResult result in results)
            {
                //Check for droppable areas
                Area a = result.gameObject.GetComponentInParent <Area>();
                if (a != null)
                {
                    a.OnDrop();
                    break;
                }
            }
            currentCard.Get().gameObject.SetActive(true);
            currentCard.Set(null);
            Settings.gameManager.SetState(playerControlState);
            onPlayerControlState.Raise();
            return;
        }
    }
コード例 #3
0
    public override void Execute()
    {
        if (card.Get() == null)
        {
            return;
        }

        if (card.Get().viz.card.cardType == creatureType)
        {
            Debug.Log("Place card down on the table.");
            bool canUse = Settings.gameManager.currentPlayer.CanUseCard(card.Get().viz.card);
            if (canUse)
            {
                Settings.DropCreatureCard(card.Get().transform, areaGrid.value.transform, card.Get());
                card.Get().currentLogic = cardDownLogic;
            }
            card.Get().gameObject.SetActive(true);
        }

        if (card.Get().viz.card.cardType == resourceType)
        {
            bool canUse = Settings.gameManager.currentPlayer.CanUseCard(card.Get().viz.card);
            if (canUse)
            {
                Settings.SetParentForCard(card.Get().transform, resourcesGrid.value.transform);
                Settings.gameManager.currentPlayer.AddResourceCard(card.Get().gameObject);
                card.Get().currentLogic = cardDownLogic;
                Settings.RegisterEvent(Settings.gameManager.currentPlayer.username + " dropped resources card " + card.Get().viz.card.name, Settings.gameManager.currentPlayer.playerColor);
            }
            card.Get().gameObject.SetActive(true);
        }
    }