Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            GridObject g = grid.GetGridObject(MouseUtils.GetMousePosition3D());
        }
        if (Input.GetMouseButtonDown(1))
        {
            Vector3 mousePos = MouseUtils.GetMousePosition3D();

            if (mousePos.magnitude != 0)
            {
                TextCreator.CreatePopupText(mousePos.ToString(), 10, 1, null, mousePos, Camera.main);
            }
        }
    }
Ejemplo n.º 2
0
    private void FillRandomly(List <CardGrid> cardGridList)
    {
        int[] test = new int[cardGridList.Count];



        List <CardSO> cardList   = GameManager.i.listOfAssets.AllCards;
        List <CardSO> tweenCards = new List <CardSO>();

        for (int i = 0; i < test.Length; i++)
        {
            test[i] = i;
        }



        int[] testRand = Subkiro.GetRandomArray(test.Length, test.Length);

        for (int i = 0; i < test.Length / 2; i++)
        {
            CardSO random = cardList[Random.Range(0, cardList.Count - 1)];
            tweenCards.Add(random);
            tweenCards.Add(random);
        }
        //Debug.Log("TweenCount -->" + tweenCards.Count);
        // Debug.Log("CardlistCount -->" + cardGridList.Count);
        // Debug.Log("int Aerray with randoms -->" + test.Length);
        for (int i = 0; i < test.Length; i++)
        {
            int x = cardGridList[testRand[i]].x;
            int y = cardGridList[testRand[i]].y;

            GameObject card = tweenCards[i].CreateCard(grid, x, y);
            card.transform.parent   = this.transform;
            card.transform.position = grid.GetWorldPosition(x, y) + new Vector3(cardSize, cardSize) * .5f;
            grid.GetGridObject(x, y).SetValue(card.GetComponent <Card>());
        }
    }