public override void OnInspectorGUI()
        {
            LeanTweenPathControl p = target as LeanTweenPathControl;

            if (p.isControl || p.isBezier == false)
            {
                LeanTweenPath path = p.transform.parent.gameObject.GetComponent <LeanTweenPath>();
                EditorGUILayout.BeginHorizontal();
                GUI.color = LTEditor.Shared.colorAdd;

                /*if( p.i-4 >= 0 && GUILayout.Button("+ Node Before", GUILayout.Height(25) ) ){
                 *                      path.addNodeAfter(p.i-4);
                 *                      SceneView.RepaintAll();
                 *              }*/
                if (GUILayout.Button("+ Node After", GUILayout.Height(25)))
                {
                    path.addNodeAfter(p.i == 0 ? 1 : p.i);
                    SceneView.RepaintAll();
                }
                GUI.color = LTEditor.Shared.colorDestruct;
                if (GUILayout.Button("Delete Node", GUILayout.Height(25)))
                {
                    Transform t = p.transform;
                    Undo.RecordObject(t, "Deleted Node " + t.gameObject.name);
                    path.deleteNode(p.i);
                    SceneView.RepaintAll();
                }
                EditorGUILayout.EndHorizontal();
            }
        }
	public void init( bool isPoint, LeanTweenPathControl[] controlRef ){
		createMaterials();
		gameObject.GetComponent<Renderer>().material = isPoint ? matPoints : matControls;

		lastPos = transform.position;
		this.controlRef = controlRef;
		lastPosControl = new Vector3[ 2 ];
		for(i=0;i<controlRef.Length;i++){
			if(controlRef[i])
				lastPosControl[i] = controlRef[i].transform.position;
		}
	}
	public void init( LeanTweenPathControl[] controlRef, int i, bool isControl ){
		this.isControl = isControl;
		this.i = i;
		createMaterials();
		gameObject.GetComponent<Renderer>().material = isControl ? matPoints : matControls;

		lastPos = transform.position;
		this.controlRef = controlRef;
		lastPosControl = new Vector3[ 2 ];
		for(int j=0;j<controlRef.Length;j++){
			if(controlRef[j])
				lastPosControl[j] = controlRef[j].transform.position;
		}
		isBezier = true;
	}
Exemple #4
0
    private void reset()
    {
        if (pathType == LeanTweenPathType.bezier)
        {
            for (i = 0; i < pts.Length; i++)
            {
                LeanTweenPathControl[] ct = new LeanTweenPathControl[2];
                if (i % 4 == 0)
                {
                    if (i + 2 < pts.Length && pts[i + 2])
                    {
                        ct[0] = pts[i + 2].gameObject.GetComponent <LeanTweenPathControl>();
                    }
                }
                else if (i % 4 == 3)
                {
                    ct[0] = gameObject.GetComponent <LeanTweenPathControl>();
                    if (i + 3 < pts.Length && pts[i + 3])
                    {
                        ct[1] = pts[i + 3].gameObject.GetComponent <LeanTweenPathControl>();
                    }
                }

                if (pts[i])
                {
                    LeanTweenPathControl pathControl = pts[i].gameObject.GetComponent <LeanTweenPathControl>();
                    pathControl.init(ct, i, i % 4 == 0 || i % 4 == 3);
                }
            }
        }
        else
        {
            for (i = 0; i < pts.Length; i++)
            {
                // LeanTweenPathControl[] ct = new LeanTweenPathControl[2];
                if (pts[i])
                {
                    LeanTweenPathControl pathControl = pts[i].gameObject.GetComponent <LeanTweenPathControl>();
                    pathControl.init(i);
                }
            }
        }
        this.count = this.lastCount = pts.Length;
    }
	private void reset(){
		if(pathType==LeanTweenPathType.bezier){
			for(i=0;i<pts.Length;i++){
				LeanTweenPathControl[] ct = new LeanTweenPathControl[2];
				if(i%4==0){
					if( i+2 < pts.Length && pts[i+2] )
						ct[0] = pts[i+2].gameObject.GetComponent<LeanTweenPathControl>();
				}else if(i%4==3){
					ct[0] = gameObject.GetComponent<LeanTweenPathControl>();
					if(i+3<pts.Length && pts[i+3])
						ct[1] = pts[i+3].gameObject.GetComponent<LeanTweenPathControl>();
				}

				if(pts[i]){
					LeanTweenPathControl pathControl = pts[i].gameObject.GetComponent<LeanTweenPathControl>();
					pathControl.init( i%4==0||i%4==3, ct);
				}
			}
		}else{
			for(i=0;i<pts.Length;i++){
				LeanTweenPathControl[] ct = new LeanTweenPathControl[2];
				if(pts[i]){
					LeanTweenPathControl pathControl = pts[i].gameObject.GetComponent<LeanTweenPathControl>();
					pathControl.init( ct );
				}
			}
		}
		this.count = this.lastCount = pts.Length;
	}
 public void init( LeanTweenPathControl[] controlRef )
 {
     createMaterials();
     gameObject.renderer.material = matPoints;
 }
	public void init( LeanTweenPathControl[] controlRef ){
		createMaterials();
		gameObject.GetComponent<Renderer>().material = matPoints;
	}
    private void reset()
    {
        if(pathType==LeanTweenPathType.bezier){
            for(i=0;i<pts.Length;i++){
                LeanTweenPathControl[] ct = new LeanTweenPathControl[]{};
                if(i%4==0){
                    if( i+2 < pts.Length)
                        ct = new LeanTweenPathControl[]{(LeanTweenPathControl)pts[i+2].gameObject.GetComponent("LeanTweenPathControl"),null};
                }else if(i%4==3){
                    ct = new LeanTweenPathControl[]{(LeanTweenPathControl)pts[i-2].gameObject.GetComponent("LeanTweenPathControl"),null};
                    if(i+3<pts.Length)
                        ct[1] = (LeanTweenPathControl)pts[i+3].gameObject.GetComponent("LeanTweenPathControl");
                }

                if(pts[i]){
                    LeanTweenPathControl pathControl = (LeanTweenPathControl)pts[i].gameObject.GetComponent("LeanTweenPathControl");
                    pathControl.init( i%4==0||i%4==3, ct);
                }
            }
        }else{
            for(i=0;i<pts.Length;i++){
                LeanTweenPathControl[] ct = new LeanTweenPathControl[]{};
                if(pts[i]){
                    LeanTweenPathControl pathControl = (LeanTweenPathControl)pts[i].gameObject.GetComponent("LeanTweenPathControl");
                    pathControl.init( ct );
                }
            }
        }
    }