Esempio n. 1
0
    public void RemoveAxles()
    {
        if (AllAxles)
        {
            Destroy(AllAxles);
        }
        AllAxles                  = Instantiate(new GameObject());
        AllAxles.name             = "AllAxles";
        AllAxles.transform.parent = CurrentLevel.transform;

        foreach (Transform CurrTile in CurrentLevel.transform)
        {
            if (CurrTile.GetComponent <BaseTile>())
            {
                BaseTile LocalCopy = CurrTile.GetComponent <BaseTile>();
                LocalCopy.Axle.transform.parent = AllAxles.transform;

                if (LocalCopy.ThisTileFlipAxis == TileFlipAxis.Vertical)
                {
                    Vector3 Temp = new Vector3(0, 0, 90);
                    LocalCopy.Axle.transform.SetPositionAndRotation(LocalCopy.Axle.transform.position, Quaternion.Euler(Temp));
                }
            }
        }

        MenuMan.SetAllAxles(AllAxles);
    }
Esempio n. 2
0
    public void GroupTiles(BaseTile ParentTile)
    {
        List <GameObject> AllGrouped = new List <GameObject>();

        foreach (Transform CurrTile in CurrentLevel.transform)
        {
            if (CurrTile.GetComponent <BaseTile>() && CurrTile.GetComponent <BaseTile>().GetTileType() == TileType.Grouped && ParentTile != CurrTile)
            {
                AllGrouped.Add(CurrTile.gameObject);
            }
        }

        foreach (GameObject CurrTile in AllGrouped)
        {
            CurrTile.transform.SetParent(ParentTile.transform);
            CurrTile.GetComponent <BaseTile>().ShadowParented(true);
        }

        BindPositionToTile(true);
    }
Esempio n. 3
0
    public void UngroupTiles(BaseTile ParentTile)
    {
        List <GameObject> AllGrouped = new List <GameObject>();

        foreach (Transform CurrentChild in ParentTile.transform)
        {
            if (CurrentChild.GetComponent <BaseTile>())
            {
                AllGrouped.Add(CurrentChild.gameObject);
            }
        }

        foreach (GameObject CurrTile in AllGrouped)
        {
            CurrTile.transform.parent = ParentTile.transform.parent;
            CurrTile.GetComponent <BaseTile>().ShadowParented(false);
            CurrTile.GetComponent <BaseTile>().RealignAxles();
        }

        BindPositionToTile(false);
    }
Esempio n. 4
0
        public bool Move(Directions dir)
        {
            if (CurrTile.hasPath(dir))
            {
                switch (dir)
                {
                case Directions.North:
                    return(Move(CurrTile.Y - 1, CurrTile.X));

                case Directions.Northeast:
                    return(Move(CurrTile.Y - 1, CurrTile.X - 1));

                case Directions.East:
                    return(Move(CurrTile.Y, CurrTile.X - 1));

                case Directions.Southeast:
                    return(Move(CurrTile.Y + 1, CurrTile.X - 1));

                case Directions.South:
                    return(Move(CurrTile.Y + 1, CurrTile.X));

                case Directions.Southwest:
                    return(Move(CurrTile.Y + 1, CurrTile.X + 1));

                case Directions.West:
                    return(Move(CurrTile.Y, CurrTile.X + 1));

                case Directions.Northwest:
                    return(Move(CurrTile.Y - 1, CurrTile.X + 1));
                }

                return(true);
            }

            return(false);
        }