示例#1
0
    ///<summary>
    /// When called checks if he is the GameObject focused on and if true activates all of his child's mesh renderers.
    ///</summary>
    ///<param name="e">The event's instance</param>
    private void OnSelectItem(OnSelectItemEvent e)
    {
        if (isDeleted)
        {
            return;
        }
        if (GameManager.gm.currentItems.Contains(gameObject))
        {
            // We manage all collider and renderer changes due to the selection
            isSelected = true;
            ToggleCollider(gameObject, false);
            UpdateParentRenderers(gameObject, false);
            if (GetComponent <OObject>().category == "rack")
            {
                UpdateOwnMeshRenderers(false);
            }

            UpdateChildMeshRenderers(true, true);
            transform.GetChild(0).GetComponent <Renderer>().enabled = true;
            return;
        }

        // If this one is part of it and is in a rack which is not the parent of a selected object we display it again
        if (GameManager.gm.previousItems.Contains(gameObject))
        {
            isSelected = false;

            // Parent racks of previously selected objects
            OObject selectionParentRack = GameManager.gm.currentItems.Count > 0 ? GameManager.gm.currentItems[0].GetComponent <OObject>()?.referent : null;
            OObject parentRack          = GetComponent <OObject>().referent;

            if (selectionParentRack != parentRack)
            {
                ToggleCollider(gameObject, false);
                ResetToRack();
            }
            else
            {
                if (!GameManager.gm.currentItems.Contains(transform.parent.gameObject))
                {
                    UpdateOwnMeshRenderers(false);
                    UpdateChildMeshRenderers(false);
                }
                else
                {
                    UpdateChildMeshRenderers(false);
                }
            }
        }
        // if (GameManager.gm.currentItems.Contains(transform.parent.gameObject) && transform.parent.GetComponent<OObject>())
        //     GetComponent<OgreeObject>().SetBaseTransform(transform.localPosition, transform.localRotation, transform.localScale);
    }
示例#2
0
 ///
 private void OnSelectItem(OnSelectItemEvent _e)
 {
     if (GameManager.gm.currentItems.Count == 0)
     {
         ActiveInputField(false);
         UpdateInputField("0");
     }
     else
     {
         ActiveInputField(true);
         UpdateInputField(GameManager.gm.currentItems[0].GetComponent <OgreeObject>().currentLod.ToString());
     }
 }
示例#3
0
 ///
 private void OnSelectItem(OnSelectItemEvent _e)
 {
     if (GameManager.gm.currentItems.Count == 0)
     {
         focusBtn.interactable        = false;
         selectParentBtn.interactable = false;
     }
     else
     {
         focusBtn.interactable        = true;
         selectParentBtn.interactable = true;
     }
     SetCurrentItemText();
     UpdateGuiInfos();
 }
示例#4
0
    ///<summary>
    /// When called checks if he is the GameObject selected and change its material.
    ///</summary>
    ///<param name="e">The event's instance</param>
    private void OnSelectItem(OnSelectItemEvent e)
    {
        if (GameManager.gm.currentItems.Contains(gameObject))
        {
            if (!isFocused)
            {
                SetMaterial(selectedMaterial);
            }
            isSelected = true;
            return;
        }
        if (GameManager.gm.previousItems.Contains(gameObject))
        {
            if (isHighlighted)
            {
                SetMaterial(highlightMaterial);
            }
            else if (isFocused)
            {
                SetMaterial(focusMaterial);
            }
            else
            {
                if (GetComponent <OObject>().category.Equals("corridor"))
                {
                    SetMaterial(transparentMaterial);
                }
                else
                {
                    SetMaterial(defaultMaterial);
                }

                transform.GetChild(0).GetComponent <Renderer>().material.color = GetComponent <OObject>().color;
            }
            isSelected = false;
        }
    }