Emitter and Collector Position
Attractor Positions
Initial States in Editor
——————————————-
EDITING – Handles Tools LOCAL SPACE
Collisions
Handles become the faces of the scale cube
progressive build of laminar and cube
File Dialog
————————————————–
————————————————–
private void Update_Spawn() { if(gameObject.activeSelf) { StartCoroutine(Spawn_Update_pause()); } } IEnumerator Spawn_Update_pause() { yield return new WaitForSeconds(0.02f); bEdit_Update = true; //argos_Particle_Spawner.oneShot_Update(); } public Redraw_Spawn Redraw_Directive() { Redraw_Spawn redraw; if (curr_EditNode != null) { curr_EditNode.setMinMax(vIn_Min, vIn_Max); } if (bEdit_Update) { bEdit_Update = false; redraw = Redraw_Spawn.IMMEDIATE; } else if (vIn_Min != vIn_Min_Last || vIn_Max != vIn_Max_Last) { redraw = Redraw_Spawn.DEFERED; } else if (editNode_Sphere.Scale_Slider_Changed() || editNode_Laminar.Scale_Slider_Changed() || editNode_Cube.Scale_Slider_Changed() || editNode_Parabolic.Scale_Slider_Changed()) { redraw = Redraw_Spawn.DEFERED; } else { redraw = Redraw_Spawn.NONE; } vIn_Max_Last = vIn_Max; vIn_Min_Last = vIn_Min; return redraw; } public void SetCurr_EditNode(UI_Ladder.Spawn_Type spawn_Type) { if (curr_EditNode != null) { curr_EditNode.setDone_Editing(); } bEditing = true; Update_Spawn(); ui_Ladder.timeMod_Val = ui_Ladder.timeMod_Slider.value = 0; //set TimeMod to Zero if (spawn_Type == UI_Ladder.Spawn_Type.SPN_SPHERE) { curr_EditNode = editNode_Sphere; curr_EditNode.setState(Editor_Node.EditState.EDITING); SetScaleCube(curr_EditNode.vIn_Min, curr_EditNode.vIn_Max); } else if(spawn_Type == UI_Ladder.Spawn_Type.SPN_LAMINAR) { curr_EditNode = editNode_Laminar; curr_EditNode.setState(Editor_Node.EditState.EDITING); SetScaleCube(curr_EditNode.vIn_Min, curr_EditNode.vIn_Max); } else if(spawn_Type == UI_Ladder.Spawn_Type.SPN_CUBE) { curr_EditNode = editNode_Cube; curr_EditNode.setState(Editor_Node.EditState.EDITING); SetScaleCube(curr_EditNode.vIn_Min, curr_EditNode.vIn_Max); } else if(spawn_Type == UI_Ladder.Spawn_Type.SPN_PARABOLIC) { curr_EditNode = editNode_Parabolic; curr_EditNode.setState(Editor_Node.EditState.EDITING); SetScaleCube(curr_EditNode.vIn_Min, curr_EditNode.vIn_Max); } else { curr_EditNode = null; bEditing = false; } } public Vector3 Clamp_my_Position(int handle_ID) { if (handle_ID == RGT) { return Clamp_Vec(scale_Handles[RGT].Pos(), vIn_Min.x, vIn_Min.y + marg, vIn_Min.z + marg, vOUT_Max.x, vIn_Max.y - marg, vIn_Max.z - marg); } else if(handle_ID == LFT) { return Clamp_Vec(scale_Handles[LFT].Pos(), vOUT_Min.x, vIn_Min.y + marg, vIn_Min.z + marg, vIn_Max.x, vIn_Max.y - marg, vIn_Max.z - marg); } if (handle_ID == TOP) { return Clamp_Vec(scale_Handles[TOP].Pos(), vIn_Min.x + marg, vIn_Min.y, vIn_Min.z + marg, vIn_Max.x - marg, vOUT_Max.y, vIn_Max.z - marg); } else if (handle_ID == BOT) { return Clamp_Vec(scale_Handles[BOT].Pos(), vIn_Min.x + marg, vOUT_Min.y, vIn_Min.z + marg, vIn_Max.x - marg, vIn_Max.y, vIn_Max.z - marg); } if (handle_ID == FRT) { return Clamp_Vec(scale_Handles[FRT].Pos(), vIn_Min.x + marg, vIn_Min.y + marg, vIn_Min.z, vIn_Max.x - marg, vIn_Max.y - marg, vOUT_Max.z); } else// if (handle_ID == BCK) { return Clamp_Vec(scale_Handles[BCK].Pos(), vIn_Min.x + marg, vIn_Min.y + marg, vOUT_Min.z, vIn_Max.x - marg, vIn_Max.y - marg, vIn_Max.z); } } void FixedUpdate() { if(bEditing != bEditLast) { if(bEditing) { Set_Scale_Cube_Alpha(0.5f); for (int i = 0; i < 6; i++) { scale_Handles[i].gameObject.SetActive(true); } } else { Set_Scale_Cube_Alpha(0.0f); for (int i = 0; i < 6; i++) { scale_Handles[i].gameObject.SetActive(false); } } } bEditLast = bEditing; if (bEditing) { vIn_Max.x = scale_Handles[RGT].Pos().x; vIn_Max.y = scale_Handles[TOP].Pos().y; vIn_Max.z = scale_Handles[FRT].Pos().z; vIn_Min.x = scale_Handles[LFT].Pos().x; vIn_Min.y = scale_Handles[BOT].Pos().y; vIn_Min.z = scale_Handles[BCK].Pos().z; float fCenter; Vector3 v; if (vIn_Max.x - vIn_Min.x < 5) { fCenter = (vIn_Max.x - vIn_Min.x) / 2f + vIn_Min.x; vIn_Min.x = fCenter - 2.5f; vIn_Max.x = fCenter + 2.5f; v = scale_Handles[RGT].Pos(); v.x = vIn_Max.x; scale_Handles[RGT].Set_LocalPos(v); v = scale_Handles[LFT].Pos(); v.x = vIn_Min.x; scale_Handles[LFT].Set_LocalPos(v); } if (vIn_Max.y - vIn_Min.y < 5) { fCenter = (vIn_Max.y - vIn_Min.y) / 2f + vIn_Min.y; vIn_Min.y = fCenter - 2.5f; vIn_Max.y = fCenter + 2.5f; v = scale_Handles[TOP].Pos(); v.y = vIn_Max.y; scale_Handles[TOP].Set_LocalPos(v); v = scale_Handles[BOT].Pos(); v.y = vIn_Min.y; scale_Handles[BOT].Set_LocalPos(v); } if (vIn_Max.z - vIn_Min.z < 5) { fCenter = (vIn_Max.z - vIn_Min.z) / 2f + vIn_Min.z; vIn_Min.z = fCenter - 2.5f; vIn_Max.z = fCenter + 2.5f; v = scale_Handles[FRT].Pos(); v.z = vIn_Max.z; scale_Handles[FRT].Set_LocalPos(v); v = scale_Handles[BCK].Pos(); v.z = vIn_Min.z; scale_Handles[BCK].Set_LocalPos(v); } Update_To_Position(vIn_Max, vIn_Min); } } public void Show_Grid(float fadeTime) { if (ui_Ladder.bCartesian_Axes_On) { duration = fadeTime; StartCoroutine("Tween_Alpha", true); } } public Vector3 Get_Max_XYZ() { return nv(scale_Handles[RGT].Pos().x, scale_Handles[TOP].Pos().y, scale_Handles[FRT].Pos().z); } public Vector3 Get_Min_XYZ() { return nv(scale_Handles[LFT].Pos().x, scale_Handles[BOT].Pos().y, scale_Handles[BCK].Pos().z); } public Vector3 Get_Outer_Max_XYZ() { return nv(outMaxX, outMaxY, outMaxZ); } public Vector3 Get_Outer_Min_XYZ() { return nv(outMinX, outMinY, outMinZ); } public void Hide_Grid(float fadeTime) { duration = fadeTime; StartCoroutine("Tween_Alpha", false); } private void Set_Grid_and_Scale_Cube_Alpha(float alpha) { Set_Scale_Cube_Alpha(alpha); } private void Set_Scale_Cube_Alpha(float alpha) { Color adjCubeCol = cubeCol; Color adjOutlineCol = OutlineCol; adjCubeCol.a = adjCubeCol.a * alpha; adjOutlineCol.a = adjOutlineCol.a * alpha; for (int i = 0; i < 24; i++) { amd.colors[i] = adjCubeCol; } for (int j = 24; j < 120; j++) { amd.colors[j] = adjOutlineCol; } GetComponent<MeshFilter>().mesh = amd.ToMesh(); } private IEnumerator Tween_Alpha(bool show) { float dir = 1; if (!show) { dir = -1; } int i = 0; //Sanity check for infinite loops while (i < 250 && ((show && grid_Alpha < 1) || (!show && grid_Alpha > 0))) { t_Accum_Coroutine += dir * Time.deltaTime; Mathf.Clamp(t_Accum_Coroutine, 0, duration); grid_Alpha = EaseMethods.CubicEaseInOut(t_Accum_Coroutine, 0, 1, duration); Set_Grid_and_Scale_Cube_Alpha(grid_Alpha); //SetAlpha_Axes_And_Fades(norm_Alpha); //MoveTester(norm_Alpha); yield return true; i++; } if (show) grid_Alpha = 1; else { grid_Alpha = 0; } Set_Grid_and_Scale_Cube_Alpha(grid_Alpha); //SetAlpha_Axes_And_Fades(norm_Alpha); //MoveTester(norm_Alpha); //Grid_Set_Alpha(norm_Alpha); StopCoroutine("Tween_Alpha"); }