Ejemplo n.º 1
0
    void Start()
    {
        wPieces = GameObject.FindGameObjectsWithTag("White");
        bPieces = GameObject.FindGameObjectsWithTag("Black");
        button  = transform.GetChild(4).gameObject;

        tc = GameObject.FindGameObjectWithTag("GameController").GetComponent <turnController>();
        cc = GameObject.FindGameObjectWithTag("GameController").GetComponent <clashController>();
    }
Ejemplo n.º 2
0
    void Start()
    {
        allies.AddRange(GameObject.FindGameObjectsWithTag(this.tag));
        if (allies.Contains(this.gameObject))
        {
            allies.Remove(this.gameObject);
        }

        arrows = transform.GetChild(0).gameObject;

        dirs = new Transform[transform.GetChild(1).childCount];
        for (int i = 0; i < dirs.Length; i++)
        {
            dirs[i] = transform.GetChild(1).GetChild(i);
        }

        GameObject[] tiles           = GameObject.FindGameObjectsWithTag("Tile");
        int          closestIndex    = 0;
        float        closestDistance = 100;

        for (int i = 0; i < tiles.Length; i++)
        {
            if (Vector3.Distance(transform.position, tiles[i].transform.position) < closestDistance)
            {
                closestDistance = Vector3.Distance(transform.position, tiles[i].transform.position);
                closestIndex    = i;
            }
        }
        targetTile = tiles[closestIndex].transform;

        wc = FindObjectOfType <winController>();
        cc = FindObjectOfType <clashController>();

        dr = FindObjectOfType <dieRoller>();

        source = GetComponent <AudioSource>();
    }