示例#1
0
    public bool AttachCardToSquare(HackCard hackCard, string[] tempCircuitConnections)
    {
        int timesToRotate = GetCountToNextLegalRotation(hackCard);

        if (timesToRotate != -1)
        {
            HackCard newHackCard = Instantiate(hackCard, new Vector2(hackholder.transform.position.x, hackholder.transform.position.y), Quaternion.identity);

            newHackCard.SetModifiedCircuit(tempCircuitConnections);

            newHackCard.transform.SetParent(hackholder.transform);
            newHackCard.transform.localScale = new Vector3(1, 1, 1);
            newHackCard.SetGridSquareHolder(this);

            for (int i = 0; i < timesToRotate; i++)
            {
                RotateCardNinetyDegrees(newHackCard);
                newHackCard.RotateCircuitsAndSpikesNinetyDegrees();
            }

            HackBattleData hackBattleData = FindObjectOfType <HackBattleData>();
            hackBattleData.SetStateToCardUI();

            newHackCard.SetupUI(GetCountToPreviousLegalRotation(newHackCard, 1), GetCountToNextLegalRotation(newHackCard, 1));
            attachedHackCard = newHackCard;
            UpdateSecurityRating();

            return(true);
        }
        else
        {
            return(false);
        }
    }