示例#1
0
    public void Move(TileLogic tile)
    {
        pathTiles.Add(tile);
        tile.IsChecked = true;
        coordinates    = tile;
        gameObject.transform.position = tile.transform.position;
        ROTATION rot = CountRotationHead();
        int      mat = ChooseMaterial();

        //head

        coordinates.GetComponent <SpriteRenderer>().sprite = box.sprites[0];
        coordinates.gameObject.transform.rotation          = Quaternion.Euler(RotationFromROTATION(rot));

        //rest
        if (pathTiles.Count >= 2)
        {
            pathTiles[pathTiles.Count - 2].GetComponent <SpriteRenderer>().sprite = box.sprites[mat];
            if (mat == 2)
            {
                rot = CountRotationSecond();
            }
            pathTiles[pathTiles.Count - 2].gameObject.transform.rotation = Quaternion.Euler(RotationFromROTATION(rot));
        }


        GameManager.Instance.CheckIfAllClicked();
        pathTiles[0].GetComponent <SpriteRenderer>().sprite = box.sprites[0];
        tile.ColorTiler(box.color);
    }
示例#2
0
    private void Start()
    {
        int          tileMask = (1 << LayerMask.NameToLayer("MapTiles"));
        RaycastHit2D hit      = Physics2D.Raycast(transform.position + new Vector3(0, 0, -1), new Vector3(0, 0, 1), 10, tileMask);

        pathTiles.Add(hit.collider.gameObject.GetComponent <TileLogic>());
        coordinates           = pathTiles[0];
        coordinates.IsChecked = true;
        coordinates.GetComponent <SpriteRenderer>().sprite = box.sprites[0];
        coordinates.ColorTiler(box.color);
    }