// ========================================================================================================== void OnDrawGizmos() { m_bUnityGizmos = true; if (enabled == false) { return; } if (Camera.main == null) { return; } if (m_SelectedTransform == null) { return; } DrawOriginalGizmo(m_SelectedTransform, IsLocalSpace()); FxmInfoIndexing com = FxmInfoIndexing.FindInstanceIndexing(m_SelectedTransform, false); if (com != null && !IsLocalSpace()) { DrawLocalGizmo(com.transform); } }
Transform GetInstanceObject() { List <FxmInfoIndexing> indexComs = FxmInfoIndexing.FindInstanceIndexings(m_SelectedTransform.transform, false); foreach (FxmInfoIndexing indexCom in indexComs) { return(indexCom.transform); } return(null); }
void AddScale(float x, float y, float z) { List <FxmInfoIndexing> indexComs = FxmInfoIndexing.FindInstanceIndexings(m_SelectedTransform.transform, false); foreach (FxmInfoIndexing indexCom in indexComs) { indexCom.transform.localScale += new Vector3(m_OldInsScale.x * x, m_OldInsScale.y * y, m_OldInsScale.z * z); } m_SelectedTransform.localScale += new Vector3(m_OldOriScale.x * x, m_OldOriScale.y * y, m_OldOriScale.z * z); }
// ========================================================================================================== void AddTranslate(float x, float y, float z, bool bLocal) { // Debug.Log(bLocal); // Debug.Log(x); List <FxmInfoIndexing> indexComs = FxmInfoIndexing.FindInstanceIndexings(m_SelectedTransform.transform, false); foreach (FxmInfoIndexing indexCom in indexComs) { indexCom.transform.Translate(x, y, z, (bLocal ? Space.Self : Space.World)); } m_SelectedTransform.Translate(x, y, z, (bLocal ? Space.Self : Space.World)); }
void MoveTranslate(Vector3 moveTo) { // Debug.Log(bLocal); // Debug.Log(x); List <FxmInfoIndexing> indexComs = FxmInfoIndexing.FindInstanceIndexings(m_SelectedTransform.transform, false); foreach (FxmInfoIndexing indexCom in indexComs) { indexCom.transform.position = moveTo; } m_SelectedTransform.position = moveTo; }
void AddRotation(float x, float y, float z, bool bLocal) { float scale = NgLayout.GetWorldPerScreenPixel(m_SelectedTransform.transform.position); m_SaveRotate += new Vector3(x / scale, y / scale, z / scale); List <FxmInfoIndexing> indexComs = FxmInfoIndexing.FindInstanceIndexings(m_SelectedTransform.transform, false); foreach (FxmInfoIndexing indexCom in indexComs) { indexCom.transform.Rotate(x / scale, y / scale, z / scale, (bLocal ? Space.Self : Space.World)); } m_SelectedTransform.Rotate(x / scale, y / scale, z / scale, (bLocal ? Space.Self : Space.World)); }
void OnRuntimeIntance(object arg) { NcEffectBehaviour._RuntimeIntance runtimeIntance = (NcEffectBehaviour._RuntimeIntance)arg; FxmInfoIndexing indexCom = runtimeIntance.m_ParentGameObject.GetComponent<FxmInfoIndexing>(); if (indexCom == null) return; // Debug.Log(runtimeIntance.m_ParentGameObject); // Debug.Log(indexCom); // Debug.Log(indexCom.m_OriginalTrans); FxmInfoIndexing.CreateInstanceIndexing(indexCom.m_OriginalTrans, runtimeIntance.m_ChildGameObject.transform, true, true); // bool bRoot = indexCom.m_OriginalTrans.gameObject == FXMakerHierarchy.inst.GetSelectedGameObject(); // FXMakerHierarchy.inst.ChangeBoundsBoxWireframe(indexCom.m_OriginalTrans.gameObject, null, bRoot, true); FXMakerHierarchy.inst.OnCreateInstanceEffect(runtimeIntance.m_ChildGameObject, false, runtimeIntance.m_ParentGameObject); }
bool CheckNotSupportComponent(GameObject targetObj, System.Type comType) { FxmInfoIndexing infoIndexingCom = null; Component findCom; string comName = ""; findCom = NsEffectManager.GetComponentInChildren(targetObj, comType); if (findCom != null) { string subString = "UnityEngine."; comName = findCom.ToString(); if (comName.Contains(subString)) { comName = comName.Replace(subString, ""); } infoIndexingCom = findCom.GetComponent <FxmInfoIndexing>(); } if (findCom is ParticleEmitter) { if (IsParticleEmitterOneShot(findCom as ParticleEmitter)) { if (infoIndexingCom != null) { NcParticleSystem ncParticleSystem = infoIndexingCom.m_OriginalTrans.GetComponent <NcParticleSystem>(); FXMakerHierarchy.inst.SetActiveComponent(infoIndexingCom.m_OriginalTrans.gameObject, ncParticleSystem, true); if (ncParticleSystem == null) { FxmPopupManager.inst.ShowWarningMessage("- Replay Error!!! : Used the ParticleEmitter.OneShot." + comName + ".\nYou must change this to NcParticleSystem.bBurst. First, add NcParticleSystem.", 5); } else { FxmPopupManager.inst.ShowWarningMessage("- Replay Error!!! : Used the ParticleEmitter.OneShot." + comName + ".\nYou must change this to NcParticleSystem.bBurst. Please click button(Inspector - 'Convert: OneShot To FXMakerBurst')", 5); } } } } else if (findCom != null) { FxmPopupManager.inst.ShowToolMessage(" - Replay Error!!! : " + comName + " is included.\nThis component does not support the replay.", 5); return(false); } return(true); }
// [HideInInspector] // static init ------------------------------------------------------------------------ public static void CreateInstanceIndexing(Transform oriTrans, Transform insTrans, bool bSameValueRecursively, bool bRuntimeCreatedObj) { if (insTrans == null) { return; } FxmInfoIndexing com = insTrans.gameObject.AddComponent <FxmInfoIndexing>(); com.SetOriginal(oriTrans, bRuntimeCreatedObj); com.OnAutoInitValue(); // Dup process NcDuplicator dupCom = com.GetComponent <NcDuplicator>(); if (dupCom != null) { GameObject clone = dupCom.GetCloneObject(); if (clone != null) { CreateInstanceIndexing(oriTrans, clone.transform, bSameValueRecursively, false); } } if (bSameValueRecursively) { for (int n = 0; n < insTrans.GetChildCount(); n++) { CreateInstanceIndexing(oriTrans, insTrans.GetChild(n), bSameValueRecursively, true); } } else { for (int n = 0; n < oriTrans.GetChildCount(); n++) { if (n < insTrans.GetChildCount()) { CreateInstanceIndexing(oriTrans.GetChild(n), insTrans.GetChild(n), bSameValueRecursively, bRuntimeCreatedObj); } } } }
bool CreateCurrentInstanceEffect(GameObject gameObj) { NgUtil.LogDevelop("CreateCurrentInstanceEffect() - gameObj - " + gameObj); GameObject parentObj = GetInstanceRoot(); m_bFrameCreateInstance = true; // 이전거 삭제 NgObject.RemoveAllChildObject(parentObj, true); // 순환 참조 prefab 검사 NcEffectBehaviour.PreloadTexture(gameObj); // 새로 생성 if (gameObj != null) { GameObject createObj = (GameObject)Instantiate(gameObj); createObj.transform.parent = parentObj.transform; FxmInfoIndexing.CreateInstanceIndexing(gameObj.transform, createObj.transform, false, false); m_InstanceEffectObject = createObj; RemoveInvaildComponent(createObj); // Grayscale GetFXMakerHierarchy().OnCreateInstanceEffect(m_InstanceEffectObject, true, null); #if (UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9) NgObject.SetActiveRecursively(createObj, true); #endif m_FXMakerControls.SetStartTime(); return(true); } m_InstanceEffectObject = null; return(false); }
bool CheckNotSupportComponent(GameObject targetObj, System.Type comType) { FxmInfoIndexing infoIndexingCom = null; Component findCom; string comName = ""; findCom = NsEffectManager.GetComponentInChildren(targetObj, comType); if (findCom != null) { string subString = "UnityEngine."; comName = findCom.ToString(); if (comName.Contains(subString)) { comName = comName.Replace(subString, ""); } infoIndexingCom = findCom.GetComponent <FxmInfoIndexing>(); } if (findCom != null) { FxmPopupManager.inst.ShowToolMessage(" - Replay Error!!! : " + comName + " is included.\nThis component does not support the replay.", 5); return(false); } return(true); }
// ----------------------------------------------------------------------------------- void LateUpdate() { if (Camera.main == null) { return; } if (FXMakerMain.inst.IsGUIMousePosition()) { return; } if (FXMakerGizmo.inst.IsActiveAxis()) { return; } if (Input.GetMouseButtonDown(0)) { GameObject pickObj = null; Vector3 clickPos = Input.mousePosition; Ray ray = Camera.main.ScreenPointToRay(clickPos); bool bFindNext = (m_LastPickPos == clickPos); // RaycastHit pickedObject; // particle { GameObject instRoot = FXMakerMain.inst.GetInstanceRoot(); FxmInfoIndexing[] coms = instRoot.GetComponentsInChildren <FxmInfoIndexing>(true); foreach (FxmInfoIndexing fxmInfoIndexing in coms) { if (fxmInfoIndexing.IsPickingParticle(ray)) { if (bFindNext) { if (m_LastPickObject == fxmInfoIndexing.gameObject) { bFindNext = false; } continue; } pickObj = fxmInfoIndexing.gameObject; break; } } } // mesh // if (pickObj == null && Physics.Raycast(ray, out pickedObject)) if (pickObj == null) { RaycastHit[] hits = Physics.RaycastAll(ray); if (hits != null && 0 < hits.Length) { float fMinDist = -1; foreach (RaycastHit hit in hits) { float dist = Vector3.Distance(hit.point, hit.collider.bounds.center); if (fMinDist < 0 || dist < fMinDist) { if (hit.transform.gameObject.GetComponent <FxmInfoIndexing>() != null) { if (bFindNext) { if (m_LastPickObject == hit.transform.gameObject) { bFindNext = false; } continue; } fMinDist = dist; pickObj = hit.transform.gameObject; } } } } } // selected if (pickObj != null) { FxmInfoIndexing indexCom = pickObj.GetComponent <FxmInfoIndexing>(); if (indexCom != null && indexCom.m_OriginalTrans.gameObject != FXMakerMain.inst.GetFXMakerHierarchy().GetSelectedGameObject()) { FXMakerMain.inst.GetFXMakerHierarchy().SetActiveGameObject(indexCom.m_OriginalTrans.gameObject); } m_LastPickPos = clickPos; m_LastPickObject = pickObj; } } }