Exemplo n.º 1
0
    private void Awake()
    {
        cardSwitcher = GetComponent <CardSwitcher>();

        //Iterate over all cards and populate the information.
        for (int cardIndex = 0; cardIndex < card.Length - 1; cardIndex++)
        {
            //Incoming Card - First Card
            card[cardIndex].Card_UI = transform.GetChild(cardIndex).transform.gameObject;
            //Incoming Card - First Card -> Ship
            card[cardIndex].EventIcon = transform.GetChild(cardIndex).transform.GetChild(0).gameObject;
            //Incoming Card - First Card -> Direction - TOP(1), LEFT(2), RIGHT(3), BOTTOM(4)
            card[cardIndex].Direction    = new GameObject[4];
            card[cardIndex].Direction[0] = transform.GetChild(cardIndex).transform.GetChild(1).gameObject;
            card[cardIndex].Direction[1] = transform.GetChild(cardIndex).transform.GetChild(2).gameObject;
            card[cardIndex].Direction[2] = transform.GetChild(cardIndex).transform.GetChild(3).gameObject;
            card[cardIndex].Direction[3] = transform.GetChild(cardIndex).transform.GetChild(4).gameObject;
            //Incoming Card - First Card -> Shield Icon
            card[cardIndex].ShieldIcon = transform.GetChild(cardIndex).transform.GetChild(5).gameObject;
            //Incoming Card - First Card -> Weapon Icon
            card[cardIndex].WeaponIcon = transform.GetChild(cardIndex).transform.GetChild(6).gameObject;
            //Incoming Card - First Card -> Countdown Time
            card[cardIndex].TimeToHit = transform.GetChild(cardIndex).transform.GetChild(7).gameObject.GetComponent <Text>();
        }
    }
Exemplo n.º 2
0
    void Awake()
    {
        //Every new cards starting position
        currentPosition = CardSwitcher.CardPosition.START;

        if (cardSwitcherRef == null)
        {
            cardSwitcherRef = GetComponentInParent <CardSwitcher>();
        }

        targetVectorPosition = new Vector3(10, 10, 10);
        targetVectorPosition = cardSwitcherRef.GetCardPositionVector(targetPosition);//returns null..
    }
Exemplo n.º 3
0
    public void StartMoving()
    {
        //set up the cardmover's internal values to start moving
        isMoving = true;



        if (currentPosition == CardSwitcher.CardPosition.FIRST)
        {
            targetPosition = CardSwitcher.CardPosition.END;
        }


        if (currentPosition == CardSwitcher.CardPosition.SECOND)
        {
            targetPosition = CardSwitcher.CardPosition.FIRST;
        }

        if (currentPosition == CardSwitcher.CardPosition.THIRD)
        {
            targetPosition = CardSwitcher.CardPosition.SECOND;
        }


        if (currentPosition == CardSwitcher.CardPosition.START)
        {
            targetPosition = CardSwitcher.CardPosition.THIRD;
        }

        //Grab the vector of the new position
        if (cardSwitcherRef == null)
        {
            cardSwitcherRef = GetComponentInParent <CardSwitcher>();
        }
        if (cardSwitcherRef != null)
        {
            targetVectorPosition = cardSwitcherRef.GetCardPositionVector(targetPosition);
        }
    }
Exemplo n.º 4
0
 public void SetCardSwitcher(CardSwitcher cSwitcher)
 {
     cardSwitcherRef = cSwitcher;
 }