Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        ScreenCenter = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2));
        MainCanvas   = FindObjectOfType <Canvas> ();
        Multiplayer  = MainCanvas.GetComponentInChildren <Submenu> ().gameObject;
        HelpButtons.AddRange(MainCanvas.GetComponentsInChildren <StartOptions> ());
        SetCounter = MainCanvas.GetComponentInChildren <PermanentMessage> ().GetComponent <Text>();

        for (int i = 0; i < 4; ++i)
        {
            PlayerScores [i] = 0;
            MainCanvas.GetComponentsInChildren <Text> () [i].text = "" + PlayerScores [i];
        }

        Vector2    Offset     = new Vector2(ScreenCenter.x - 8, ScreenCenter.y - 4);
        GameObject CardPrefab = Resources.Load <GameObject> ("Prefabs/Card");
        GameObject NewCard;

        for (int i = 0; i < 81; ++i)
        {
            NewCard = Instantiate(CardPrefab, transform);
            NewCard.GetComponent <Card>().TargetPos = new Vector3(Offset.x + Mathf.Floor(i / 9f) * 2, Offset.y + (i % 9f) * 1, 1);
            NewCard.transform.localPosition         = new Vector3(-3, -3, 1);
            NewCard.GetComponent <Card> ().SetDesign(i);
            Deck.Add(NewCard);
        }

        Multiplayer.SetActive(false);
    }
Ejemplo n.º 2
0
//	deck destruction is working with this function and above if statement...
//	void DestroyDeck(){
//		Destroy(this.gameObject);
//	}



    //VISUAL
    GameObject CreateACardAtPositionX(StoryAsset c, Vector3 position, Vector3 eulerAngles)
    {
        // Instantiate a card depending on its type
        GameObject NewCard;
        //GameObject OldCard;

        Vector3 temp;

        //List<Vector3> newtemp = new List<Vector3> ();
        //int ind = new Random(0,newtemp.Count);
        //Vector3 newtemp;

        if (c.Description.ToString().Equals("EVENT"))
        {
            NewCard = GameObject.Instantiate(eventCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
        }
        else if (c.Description.ToString().Equals("QUEST"))
        {
            NewCard = GameObject.Instantiate(questCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
        }
        else
        {
            NewCard = GameObject.Instantiate(tournamentCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
        }

        temp = new Vector3(newDeck.transform.position.x + 0f * index, newDeck.transform.position.y, newDeck.transform.position.z);

        NewCard.transform.position = temp;

        //newtemp.Add(new Vector3(newDeck.transform.position.x + 0.5f * index, newDeck.transform.position.y, newDeck.transform.position.z));
        //NewCard.transform.position = newtemp;

        print(temp);



        //this fucntion destroys newCards, as soon as they are created.
        if (newDeck.storyDeck.Count > 0)
        {
            DestroyObject(NewCard, 1);
        }

        StoryCardManager manager = NewCard.GetComponent <StoryCardManager>();

        manager.storyAsset = c;
        manager.ReadCardFromAsset();
        index++;
        return(NewCard);
    }
Ejemplo n.º 3
0
    GameObject CreateACardAtPositionX(AdventureAsset c, Vector3 position, Vector3 eulerAngles)
    {
        // Instantiate a card depending on its type
        GameObject NewCard;
        Vector3    temp;

        NewCard = GameObject.Instantiate(allyCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;

        temp = new Vector3(newDeck.transform.position.x + 0.5f, newDeck.transform.position.y, newDeck.transform.position.z);
        NewCard.transform.position = temp;
        AdventureCardManager manager = NewCard.GetComponent <AdventureCardManager>();

        manager.adventureAsset = c;
        manager.ReadCardFromAsset();
        return(NewCard);
    }
Ejemplo n.º 4
0
    void CreateRankCard(RankAsset currentRank)
    {
        // Instantiate a card depending on its type
        GameObject NewCard;
        Vector3    temp;

        NewCard = GameObject.Instantiate(rankPrefab, new Vector3(0f, 0f, 0f), Quaternion.Euler(new Vector3(0f, 0f, 0f))) as GameObject;
        //New Rank Card will stay to the left of the player's hand
        if (PArea.owner == AreaPosition.Low)
        {
            temp = new Vector3(hand.transform.position.x - 2f, hand.transform.position.y - 0.5f, hand.transform.position.z);
        }
        else
        {
            temp = new Vector3(hand.transform.position.x - 2.3f, hand.transform.position.y - 0.5f, hand.transform.position.z);
        }
        NewCard.transform.position = temp;
        NewCard.transform.SetParent(rank.transform, true);

        RankCardManager manager = NewCard.GetComponent <RankCardManager>();

        manager.rankAsset = currentRank;
        manager.ReadCardFromAsset();
    }
Ejemplo n.º 5
0
    //VISUAL
    AdventureCardManager CreateACardAtPosition(AdventureAsset newAdventureCard, CardLogic newLogic, Vector3 eulerAngles = default(Vector3), Vector3 position = default(Vector3))
    {
        // Instantiate a card depending on its type
        GameObject NewCard;
        Vector3    temp;

        if (newAdventureCard.Description.ToString().Equals("ALLY"))
        {
            NewCard = GameObject.Instantiate(allyCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
        }
        else if (newAdventureCard.Description.ToString().Equals("WEAPON"))
        {
            NewCard = GameObject.Instantiate(weaponCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
        }
        else if (newAdventureCard.Description.ToString().Equals("AMOUR"))
        {
            NewCard = GameObject.Instantiate(amourCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
        }
        else if (newAdventureCard.Description.ToString().Equals("TEST"))
        {
            NewCard = GameObject.Instantiate(testCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
        }
        else
        {
            NewCard = GameObject.Instantiate(foeCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
        }

        EventTrigger trigger = NewCard.gameObject.GetComponent <EventTrigger> ();

        EventTrigger.Entry entry = new EventTrigger.Entry();
        entry.eventID = EventTriggerType.PointerClick;
        entry.callback.AddListener((evenData) => {
            UseCard(NewCard.GetComponent <AdventureCardManager>());
        });
        trigger.triggers.Add(entry);

        temp = new Vector3(hand.transform.position.x + cardIndex, hand.transform.position.y, hand.transform.position.z);

        NewCard.transform.position = temp;
        NewCard.transform.SetParent(hand.transform, true);
        cardIndex++;

        AdventureCardManager manager = NewCard.GetComponent <AdventureCardManager>();

        manager.adventureAsset = newAdventureCard;
        manager.ReadCardFromAsset();

        IDHolder id = NewCard.AddComponent <IDHolder>();

        id.UniqueID = newLogic.UniqueCardID;

        //add to cards dealt
        hand.cardsDealt.Add(NewCard);

        //hide enemy card from player
        if (isAI)
        {
            NewCard.GetComponent <HoverPreview> ().ThisPreviewEnabled = false;
        }

        return(manager);
    }