Esempio n. 1
0
    public virtual bool CanMove(Vector3 dir)
    {
        foreach (Tile tile in tiles)
        {
            Vector3Int posToCheck = Vector3Int.RoundToInt(tile.pos + dir);
            if (Utils.WallIsAtPos(posToCheck))
            {
                return(false);
            }
            Mover m = Utils.GetMoverAtPos(posToCheck);
            if (m != null && m != this)
            {
                if (!isPlayer && !Game.isPolyban)
                {
                    return(false);
                }
                if (m.CanMove(dir))
                {
                    m.MoveIt(dir);
                }
                else
                {
                    return(false);
                }
            }
        }

        return(true);
    }