void Update()
    {
        if (target)
        {
            Vector3 scale = target.localScale;

            if (globe == null)
            {
                globe = GetComponent <MegaGlobe>();
            }

            if (globe)
            {
                globe.radius = scale.x / 2.0f;

                Vector3 lpos = Vector3.zero;

                lpos.x = Mathf.Sin(angle) * globe.radius;
                lpos.z = Mathf.Cos(angle) * globe.radius;

                Vector3 pos = target.position + lpos;                   //target.TransformPoint(lpos);
                transform.position = pos;
            }
        }
    }
    public override bool Inspector()
    {
        MegaGlobe mod = (MegaGlobe)target;

#if !UNITY_5 && !UNITY_2017
        EditorGUIUtility.LookLikeControls();
#endif
        mod.radius = EditorGUILayout.FloatField("Radius", mod.radius);
        //mod.amplify = EditorGUILayout.FloatField("Amplify", mod.amplify);

        mod.linkRadii = EditorGUILayout.Toggle("Link Radii", mod.linkRadii);
        if (!mod.linkRadii)
        {
            mod.radius1 = EditorGUILayout.FloatField("Radius1", mod.radius1);
        }

        mod.dir  = EditorGUILayout.FloatField("Dir", mod.dir);
        mod.axis = (MegaAxis)EditorGUILayout.EnumPopup("Axis", mod.axis);

        mod.twoaxis = EditorGUILayout.BeginToggleGroup("Two Axis", mod.twoaxis);
        mod.dir1    = EditorGUILayout.FloatField("Dir1", mod.dir1);
        mod.axis1   = (MegaAxis)EditorGUILayout.EnumPopup("Axis1", mod.axis1);
        EditorGUILayout.EndToggleGroup();

        return(false);
    }
예제 #3
0
    void Update()
    {
        if ( target )
        {
            Vector3 scale = target.localScale;

            if ( globe == null )
            {
                globe = GetComponent<MegaGlobe>();
            }

            if ( globe )
            {
                globe.radius = scale.x / 2.0f;

                Vector3 lpos = Vector3.zero;

                lpos.x = Mathf.Sin(angle) * globe.radius;
                lpos.z = Mathf.Cos(angle) * globe.radius;

                Vector3 pos = target.position + lpos;	//target.TransformPoint(lpos);
                transform.position = pos;
            }
        }
    }