Esempio n. 1
0
    void OnSceneGUI()
    {
        to = target as TileOption;

        // tile selection
        Handles.color = Color.green;
        if (Handles.Button(to.transform.position + (Vector3.forward + Vector3.left) / 4 + to.transform.up * to.size, Quaternion.LookRotation(Vector3.up), to.size * 2, to.size * 1.7f, Handles.CylinderCap))
        {
            to.NextEnvironment();
        }

        Handles.color = Color.red;
        if (Handles.Button(to.transform.position + (Vector3.forward + Vector3.right) / 4 + to.transform.up * to.size, Quaternion.LookRotation(Vector3.up), to.size * 2, to.size * 1.7f, Handles.CylinderCap))
        {
            to.NextObstacle();
        }


        Handles.color = Color.blue;
        if (Handles.Button(to.transform.position + (Vector3.back + Vector3.left) / 4 + to.transform.up * to.size, Quaternion.LookRotation(Vector3.up), to.size * 2, to.size * 1.7f, Handles.CylinderCap))
        {
            to.NextTexture();
        }


        Handles.color = Color.grey;
        if (Handles.Button(to.transform.position + (Vector3.back + Vector3.right) / 4 + to.transform.up * to.size, Quaternion.LookRotation(Vector3.up), to.size * 2, to.size * 1.7f, Handles.CylinderCap))
        {
            to.Hide();
        }

        // tile expansion
        Handles.color = Color.yellow;
        if (Handles.Button(to.transform.position + Vector3.forward / 2 + to.transform.up * to.size, Quaternion.LookRotation(Vector3.up), to.size * 2, to.size * 1.7f, Handles.CylinderCap))
        {
            GameObject tile = to.ExpandForward();
            Selection.activeObject = tile;
        }

        if (Handles.Button(to.transform.position + Vector3.right / 2 + to.transform.up * to.size, Quaternion.LookRotation(Vector3.up), to.size * 2, to.size * 1.7f, Handles.CylinderCap))
        {
            GameObject tile = to.ExpandRight();
            Selection.activeObject = tile;
        }

        if (Handles.Button(to.transform.position + Vector3.back / 2 + to.transform.up * to.size, Quaternion.LookRotation(Vector3.up), to.size * 2, to.size * 1.7f, Handles.CylinderCap))
        {
            GameObject tile = to.ExpandBack();
            Selection.activeObject = tile;
        }

        if (Handles.Button(to.transform.position + Vector3.left / 2 + to.transform.up * to.size, Quaternion.LookRotation(Vector3.up), to.size * 2, to.size * 1.7f, Handles.CylinderCap))
        {
            GameObject tile = to.ExpandLeft();
            Selection.activeObject = tile;
        }
    }
Esempio n. 2
0
    private void DrawTileOptions()
    {
        _tileOptionsFoldout = gui.EzFoldout("Tile Options", _tileOptionsFoldout);

        if (!_tileOptionsFoldout)
        {
            return;
        }

        if (_target.TileOptions.Count == 0)
        {
            gui.EzHelpBox("Lista de options vazia. Nao sera possivel criar um terreno.", MessageType.Warning, true);
        }

        foreach (var option in _target.TileOptions)
        {
            using (gui.Horizontal())
            {
                option.Name   = gui.EzTextField("", option.Name);
                option.Sprite = gui.EzObjectField("", option.Sprite, 0, GUILayout.Width(100));
                option.Weight = gui.EzIntField("Weight", option.Weight);
                if (gui.EzButton(gui.DeleteButton))
                {
                    _target.TileOptions.Remove(option);
                }
            }
        }

        using (gui.Horizontal())
        {
            _newTile.Sprite = gui.EzObjectField("New Tile", _newTile.Sprite);
            _newTile.Weight = gui.EzIntField("Weight", _newTile.Weight);
            if (_newTile.Sprite != null)
            {
                _target.TileOptions.Add(_newTile);
                _newTile = new TileOption();
            }
        }
    }
Esempio n. 3
0
        public static TileOption[] BuildOptions(
            this char[][] @this,
            int id)
        {
            var options = new TileOption[8];

            for (var flipped = 0; flipped < 2; flipped++)
            {
                for (var rotated = 0; rotated < 4; rotated++)
                {
                    var permutation = @this.Permutate(flipped == 1, rotated);

                    var borders = Enumerable.Range(0, 4).Select(permutation.GetBorder).ToArray();

                    options[flipped * 4 + rotated] = new(
                        id,
                        borders,
                        permutation);
                }
            }

            return(options);
        }
Esempio n. 4
0
        public NewTabControl(TileOption option)
        {
            InitializeComponent();

            SetContent(option);
        }
Esempio n. 5
0
        public void SetContent(TileOption option)
        {
            var content = option.Control();
            if (content == null)
                return;

            Container.Children.Clear();
            Container.Children.Add(content);
            TabName = option.Title;

            OptionsSelector.Visibility = Visibility.Collapsed;
        }