Exemple #1
0
    private static void AddRefPoints()
    {
        PEBlockAlign align = Selection.activeGameObject.GetComponent <PEBlockAlign>();

        if (align == null)
        {
            Selection.activeGameObject.AddComponent <PEBlockAlign>();
        }

        //处理特殊
        string name  = Selection.activeGameObject.name;
        int    index = Selection.activeGameObject.name.IndexOf("(Clone)");

        if (index > 0)
        {
            name = name.Substring(0, index);
        }
        BlockData data = PBDataBaseManager.Instance.GetBlockWithPrefabName(name);

        if (data.type == "wire")
        {
            Transform head = Selection.activeTransform.Find("head_2");
            if (head.GetComponent <PEBlockAlign>() == null)
            {
                head.gameObject.AddComponent <PEBlockAlign>();
            }
        }
    }
Exemple #2
0
    private static void RemoveRefPoints()
    {
        PEBlockAlign align = Selection.activeGameObject.GetComponent <PEBlockAlign>();

        if (align != null)
        {
            align.ClearRefPoints();
            Component.DestroyImmediate(align);
        }
    }
Exemple #3
0
    void OnEnable()
    {
        bool isInProject = EditorUtility.IsPersistent(this.target);

        if (!isInProject)
        {
            blockAlign = this.target as PEBlockAlign;
            blockAlign.ShowRefPoints();
        }
        blockAlign = (PEBlockAlign)target;
    }
Exemple #4
0
    public override void OnInspectorGUI()
    {
        PEBlockAlign blockAlign = target as PEBlockAlign;

        if (GUILayout.Button("Reset"))
        {
            blockAlign.transform.position = Vector3.zero;
            blockAlign.transform.rotation = Quaternion.identity;
            blockAlign.ClearRefPoints();
            blockAlign.ShowRefPoints();
        }

        if (GUILayout.Button("Hide"))
        {
            blockAlign.HideRefPoints();
        }

        if (GUILayout.Button("Show"))
        {
            blockAlign.ShowRefPoints();
        }
    }
Exemple #5
0
    private void Rotate(Vector3 axi)
    {
        PEBlockAlign example = (PEBlockAlign)target;

        example.transform.Rotate(axi, 90, Space.Self);
    }
Exemple #6
0
 public void Init(PEBlockAlign blockAlign, RefPointType pointType)
 {
     this.blockAlign = blockAlign;
     refPointType    = pointType;
 }