Пример #1
0
    InteractiveItem interactible;               // Objeto interactivo que estamos utilizando

    /// <summary>
    /// Evento Start de MonoBehavior.
    /// Se ejecuta una vez al inicio.
    /// </summary>
    virtual public void Start()
    {
        if (reticle == null)
        {
            return;
        }

        // El componente Selection.cs también está pensado para estar asociado a la cámara.
        uiSelection = GetComponent <UISelection>();

        // Almacenamos el tamaño y la orientación original de la retícula.
        originalScale    = reticle.localScale;
        originalRotation = reticle.localRotation;
    }
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.name.Contains("SquareTarget"))
     {
         ScoreBehavior.UpdateScore(1);
     }
     else if (collision.gameObject.name == "right")
     {
         UISelection.OnRightSelected();
     }
     else if (collision.gameObject.name == "left")
     {
         UISelection.OnLeftSelected();
     }
     else
     {
         HealthBehavior.UpdateHealth();
     }
 }
Пример #3
0
        /// <summary>
        /// выделение фигуры и отмена выделений
        /// </summary>
        /// <param name="e"></param>
        private void SelectAndDeselect(MouseButtonEventArgs e)
        {
            if (!MainWindow.GameWindow.IsActive)
            {
                return;
            }
            UISelection.ToggleSelection(e.OriginalSource, e);
            SolidColorBrush stroke_color = new SolidColorBrush();

            stroke_color.Color = Colors.Green;
            // выделение для контейнера временных фигур;
            int len = UISelection.AllFigures.Count;

            if (UISelection.SelectedItems.Count != 0)
            {
                foreach (FrameworkElement s in UISelection.SelectedItems)
                {
                    if (s is Shape)
                    {
                        (s as Shape).Stroke          = stroke_color;
                        (s as Shape).StrokeThickness = 3;
                    }
                }
            }
            else if (len > 1)
            {
                foreach (FrameworkElement s in UISelection.AllFigures[len - 1])
                {
                    if (s is Shape)
                    {
                        (s as Shape).Stroke          = stroke_color;
                        (s as Shape).StrokeThickness = 3;
                    }
                }
            }
        }
Пример #4
0
 // Start is called before the first frame update
 void Start()
 {
     uiSelection = GetComponent <UISelection>();
     Initialize(targetRN);
 }
Пример #5
0
    void SelectionUI(float width)
    {
        EditorGUILayout.BeginVertical();

        EditorGUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();

        if (selection == UISelection.Sprites)
        {
            GUI.enabled = false;
        }
        if (GUILayout.Button("Sprites UI", GUILayout.Width(100f)))
        {
            selection = UISelection.Sprites;
        }
        GUI.enabled = true;

        if (selection == UISelection.Prefabs)
        {
            GUI.enabled = false;
        }
        if (GUILayout.Button("Prefabs UI", GUILayout.Width(100f)))
        {
            selection = UISelection.Prefabs;
        }
        GUI.enabled = true;

        if (selection == UISelection.Map)
        {
            GUI.enabled = false;
        }
        if (GUILayout.Button("Map UI", GUILayout.Width(100f)))
        {
            selection = UISelection.Map;
        }
        GUI.enabled = true;

        GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();

        switch (selection)
        {
        case UISelection.Sprites:
            SpriteManager.DisplayUI(width);
            break;

        case UISelection.Prefabs:
            PrefabManager.DisplayUI(width);
            break;

        case UISelection.Map:
            MapManager.DisplayUI(width);
            break;
        }

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.EndVertical();
    }
Пример #6
0
 public void OnClick()
 {
     UISelection.OnRightSelected();
 }
Пример #7
0
 public void OnClick()
 {
     UISelection.OnLeftSelected();
 }