Example #1
0
    public void GoBack()
    {
        pathTiles[pathTiles.Count - 1].IsChecked = false;

        pathTiles[pathTiles.Count - 1].GetComponent <SpriteRenderer>().sprite = box.sprites[3];
        pathTiles.RemoveAt(pathTiles.Count - 1);
        coordinates = pathTiles[pathTiles.Count - 1];
        gameObject.transform.position = pathTiles[pathTiles.Count - 1].transform.position;
        ROTATION rot = CountRotationHead();

        coordinates.GetComponent <SpriteRenderer>().sprite  = box.sprites[1];
        coordinates.gameObject.transform.rotation           = Quaternion.Euler(RotationFromROTATION(rot));
        pathTiles[0].GetComponent <SpriteRenderer>().sprite = box.sprites[0];
        coordinates.GetComponent <SpriteRenderer>().sprite  = box.sprites[0];
    }
Example #2
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);
    }
Example #3
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);
    }
Example #4
0
 private void Start()
 {
     coordinates.IsChecked = true;
     coordinates.GetComponent <Renderer>().sharedMaterial = materials[1];
 }