static void RenderGizmo(MegaWarp warp, GizmoType gizmoType) { if ( MegaModifiers.GlobalDisplay && warp.DisplayGizmo ) { Color col = Color.white; #if UNITY_5_1 || UNITY_5_2 if ( (gizmoType & GizmoType.NotInSelectionHierarchy) != 0 ) #else if ( (gizmoType & GizmoType.NotInSelectionHierarchy) != 0 ) #endif { col.a = 0.5f; } else { if ( (gizmoType & GizmoType.Active) != 0 ) { if ( warp.Enabled ) col.a = 1.0f; else col.a = 0.75f; } else { if ( warp.Enabled ) col.a = 0.5f; else col.a = 0.25f; } } warp.DrawGizmo(col); Gizmos.DrawIcon(warp.transform.position, warp.GetIcon(), false); } }
public override bool Prepare(MegaModContext mc) { if (SourceWarpObj != current) { current = SourceWarpObj; warp = null; } if (SourceWarpObj != null) { if (warp == null) { warp = SourceWarpObj.GetComponent <MegaWarp>(); } if (warp != null && warp.Enabled) { tm = transform.localToWorldMatrix; invtm = tm.inverse; return(warp.Prepare(decay)); } } return(false); }
static void RenderGizmo(MegaWarp warp, GizmoType gizmoType) { if (MegaModifiers.GlobalDisplay && warp.DisplayGizmo) { if ((gizmoType & GizmoType.NotInSelectionHierarchy) != 0) { if ((gizmoType & GizmoType.Active) != 0) { if (warp.Enabled) { warp.DrawGizmo(Color.white); } else { warp.DrawGizmo(new Color(1.0f, 1.0f, 0.0f, 0.75f)); } } else { if (warp.Enabled) { warp.DrawGizmo(new Color(0.0f, 1.0f, 0.0f, 0.5f)); } else { warp.DrawGizmo(new Color(1.0f, 0.0f, 0.0f, 0.25f)); } } } Gizmos.DrawIcon(warp.transform.position, warp.GetIcon(), false); } }
void AddModType(GameObject go, System.Type name, bool modobj) { if (go) { if (!name.IsSubclassOf(typeof(MegaModifier)) && !name.IsSubclassOf(typeof(MegaWarp))) { go.AddComponent(name); } else { MeshFilter mf = go.GetComponent <MeshFilter>(); if (mf != null) { if (modobj) { if (name.IsSubclassOf(typeof(MegaModifier))) { MegaModifyObject mod = go.GetComponent <MegaModifyObject>(); if (mod == null) { mod = go.AddComponent <MegaModifyObject>(); mod.NormalMethod = NormalMethod; } } } if (name != null) { if (name.IsSubclassOf(typeof(MegaModifier))) { MegaModifier md = (MegaModifier)go.AddComponent(name); if (md) { md.gizCol1 = col1; md.gizCol2 = col2; } } else { if (name.IsSubclassOf(typeof(MegaWarp))) { MegaWarp md = (MegaWarp)go.AddComponent(name); if (md) { md.GizCol1 = col1; md.GizCol2 = col2; } } else { go.AddComponent(name); } } } } } } }
public override void ModStart(MegaModifiers mc) { if (SourceWarpObj != null && SourceWarpObj != current) { current = SourceWarpObj; warp = SourceWarpObj.GetComponent <MegaWarp>(); } }
//void Reset() //{ //if ( SourceWarpObj != null ) //warp = SourceWarpObj.GetComponent<Warp>(); //} public override void ModStart(MegaModifiers mc) { if ( SourceWarpObj != null && SourceWarpObj != current ) { current = SourceWarpObj; warp = SourceWarpObj.GetComponent<MegaWarp>(); } }
public virtual void DrawSceneGUI() { MegaWarp mod = (MegaWarp)target; if (mod.Enabled && mod.DisplayGizmo && showmodparams) { } }
//void Reset() //{ //if ( SourceWarpObj != null ) //warp = SourceWarpObj.GetComponent<Warp>(); //} public override void ModStart(MegaModifiers mc) { if (SourceWarpObj != null && SourceWarpObj != current) { current = SourceWarpObj; warp = SourceWarpObj.GetComponent <MegaWarp>(); //Debug.Log("new warp1 " + SourceWarpObj.name); } }
public void CommonModParams(MegaWarp mod) { showmodparams = EditorGUILayout.Foldout(showmodparams, "Warp Common Params"); if ( showmodparams ) { EditorGUILayout.BeginVertical("Box"); CommonModParamsBasic(mod); mod.Width = EditorGUILayout.FloatField("Width", mod.Width); mod.Height = EditorGUILayout.FloatField("Height", mod.Height); mod.Length = EditorGUILayout.FloatField("Length", mod.Length); mod.Decay = EditorGUILayout.FloatField("Decay", mod.Decay); EditorGUILayout.EndVertical(); } }
public void CommonModParamsBasic(MegaWarp mod) { mod.Enabled = EditorGUILayout.Toggle("Enabled", mod.Enabled); mod.DisplayGizmo = EditorGUILayout.Toggle("Display Gizmo", mod.DisplayGizmo); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Gizmo Col"); mod.GizCol1 = EditorGUILayout.ColorField(mod.GizCol1); mod.GizCol2 = EditorGUILayout.ColorField(mod.GizCol2); EditorGUILayout.EndHorizontal(); //mod.steps = EditorGUILayout.IntField("Gizmo Detail", mod.steps); //if ( mod.steps < 1 ) // mod.steps = 1; }
public void CommonModParams(MegaWarp mod) { showmodparams = EditorGUILayout.Foldout(showmodparams, "Warp Common Params"); if (showmodparams) { EditorGUILayout.BeginVertical("Box"); CommonModParamsBasic(mod); mod.Width = EditorGUILayout.FloatField("Width", mod.Width); mod.Height = EditorGUILayout.FloatField("Height", mod.Height); mod.Length = EditorGUILayout.FloatField("Length", mod.Length); mod.Decay = EditorGUILayout.FloatField("Decay", mod.Decay); EditorGUILayout.EndVertical(); } }
public virtual void DrawGUI() { MegaWarp mod = (MegaWarp)target; if (DisplayCommon()) { CommonModParams(mod); } if (GUI.changed) { EditorUtility.SetDirty(target); } if (Inspector()) { DrawDefaultInspector(); } }
static void RenderGizmo(MegaWarp warp, GizmoType gizmoType) { if (MegaModifiers.GlobalDisplay && warp.DisplayGizmo) { Color col = Color.white; #if UNITY_5_1 || UNITY_5_2 || UNITY_5_3 || UNITY_5_4 || UNITY_5_5 || UNITY_6 if ((gizmoType & GizmoType.NotInSelectionHierarchy) != 0) #else if ((gizmoType & GizmoType.NotInSelectionHierarchy) != 0) #endif { col.a = 0.5f; } else { if ((gizmoType & GizmoType.Active) != 0) { if (warp.Enabled) { col.a = 1.0f; } else { col.a = 0.75f; } } else { if (warp.Enabled) { col.a = 0.5f; } else { col.a = 0.25f; } } } warp.DrawGizmo(col); Gizmos.DrawIcon(warp.transform.position, warp.GetIcon(), false); } }
public override bool Prepare(MegaModContext mc) { if ( SourceWarpObj != current ) { current = SourceWarpObj; warp = null; } if ( SourceWarpObj != null ) { if ( warp == null ) warp = SourceWarpObj.GetComponent<MegaWarp>(); if ( warp != null && warp.Enabled ) { tm = transform.localToWorldMatrix; invtm = tm.inverse; return warp.Prepare(decay); } } return false; }
static void RenderGizmo(MegaWarp warp, GizmoType gizmoType) { if ( MegaModifiers.GlobalDisplay && warp.DisplayGizmo ) { if ( (gizmoType & GizmoType.NotSelected) != 0 ) { if ( (gizmoType & GizmoType.Active) != 0 ) { if ( warp.Enabled ) warp.DrawGizmo(Color.white); else warp.DrawGizmo(new Color(1.0f, 1.0f, 0.0f, 0.75f)); } else { if ( warp.Enabled ) warp.DrawGizmo(new Color(0.0f, 1.0f, 0.0f, 0.5f)); else warp.DrawGizmo(new Color(1.0f, 0.0f, 0.0f, 0.25f)); } } Gizmos.DrawIcon(warp.transform.position, warp.GetIcon()); } }
//[DrawGizmo(GizmoType.SelectedOrChild)] //static void RenderGizmoSelected(Warp warp, GizmoType gizmoType) //{ //if ( Modifiers.GlobalDisplay && warp.DisplayGizmo ) //{ //if ( warp.Enabled ) //warp.DrawGizmo(Color.white); //else //warp.DrawGizmo(new Color(1.0f, 1.0f, 0.0f, 0.75f)); //Gizmos.DrawIcon(warp.transform.position, warp.GetIcon()); //} //} private void OnEnable() { src = target as MegaWarp; undoManager = new MegaUndo(src, src.WarpName() + " change"); }
private void OnEnable() { src = target as MegaWarp; undoManager = new MegaUndo(src, src.WarpName() + " change"); }
//void Reset() //{ //if ( SourceWarpObj != null ) //warp = SourceWarpObj.GetComponent<Warp>(); //} public override void ModStart(MegaModifiers mc) { if ( SourceWarpObj != null && SourceWarpObj != current ) { current = SourceWarpObj; warp = SourceWarpObj.GetComponent<MegaWarp>(); //Debug.Log("new warp1 " + SourceWarpObj.name); } }
public override bool Prepare(MegaModContext mc) { if ( SourceWarpObj != current ) { //Debug.Log("Changing target "); current = SourceWarpObj; warp = null; } if ( SourceWarpObj != null ) { if ( warp == null ) { //Debug.Log("new warp " + SourceWarpObj.name); warp = SourceWarpObj.GetComponent<MegaWarp>(); } if ( warp != null && warp.Enabled ) { tm = transform.localToWorldMatrix; invtm = tm.inverse; return warp.Prepare(decay); } } return false; }