Beispiel #1
0
 void SetClipboardComponent(Component selCom)
 {
     m_CopyCloneGameObject = NgObject.CreateGameObject(gameObject.transform, selCom.gameObject.name);
     NgObject.SetActiveRecursively(m_CopyCloneGameObject, false);
     m_CopyCloneObject = NgSerialized.AddComponent(m_CopyCloneGameObject, selCom);
     NgSerialized.CopySerialized(selCom, (m_CopyCloneObject as Component));
 }
Beispiel #2
0
    public void SetCloneObject(int nCloneIndex, GameObject prefab)
    {
        // 扁粮 巴 昏力
        if (m_ChildObjects[nCloneIndex] != null)
        {
            Object.DestroyImmediate(m_ChildObjects[nCloneIndex]);
            m_ChildObjects[nCloneIndex]        = null;
            m_CloneThumbFilenames[nCloneIndex] = "";
        }

        // 货肺款 瞒老靛 殿废
        if (prefab != null)
        {
            m_ChildObjects[nCloneIndex] = NgAsset.LoadPrefab(prefab, gameObject);
            NgObject.SetActiveRecursively(m_ChildObjects[nCloneIndex], true);
            m_ChildObjects[nCloneIndex].name = m_ChildObjects[nCloneIndex].name.Replace("(Clone)", "");

            // 荤侩等 prefab苞 GameObject甫 急琶茄促.
            FXMakerAsset.SetPingObject(prefab, m_ChildObjects[nCloneIndex]);

            // thumb 免仿阑 困秦辑 盔夯prefab狼 guid甫 历厘秦 敌促.
            m_CloneThumbFilenames[nCloneIndex] = NgAsset.GetPrefabThumbFilename(prefab);
        }
        FXMakerBackground.inst.SaveBackgroundPrefab();
    }
Beispiel #3
0
    private void CreateEffect()
    {
        if (this.m_EffectPrefabs[this.m_nIndex] == null)
        {
            return;
        }
        if (this.m_EffectGUIText != null)
        {
            this.m_EffectGUIText.text = this.m_EffectPrefabs[this.m_nIndex].name;
        }
        float num = 0f;

        if (1 < this.m_nCreateCount)
        {
            num = this.m_fRandomRange;
        }
        for (int i = 0; i < this.GetInstanceRoot().transform.childCount; i++)
        {
            UnityEngine.Object.Destroy(this.GetInstanceRoot().transform.GetChild(i).gameObject);
        }
        for (int j = 0; j < this.m_nCreateCount; j++)
        {
            GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(this.m_EffectPrefabs[this.m_nIndex], new Vector3(UnityEngine.Random.Range(-num, num), 0f, UnityEngine.Random.Range(-num, num)), Quaternion.identity);
            gameObject.transform.localScale = gameObject.transform.localScale * this.m_fCreateScale;
            NcEffectBehaviour.PreloadTexture(gameObject);
            gameObject.transform.parent = this.GetInstanceRoot().transform;
            NgObject.SetActiveRecursively(gameObject, true);
        }
    }
Beispiel #4
0
    public static GameObject LoadPrefab(GameObject srcPrefab, GameObject targetObject)
    {
        string path = AssetDatabase.GetAssetPath(srcPrefab);

        NgUtil.LogDevelop("LoadPrefab() - strPrefabPath - " + path);

        // 선택된 asset 로드 (project to Hierarchy)
//      GameObject prefab	= (GameObject)AssetDatabase.LoadAssetAtPath(path, typeof(GameObject));
//		GameObject obj		= NgObject.CreateGameObject(targetObject, prefab);

        GameObject obj = PrefabUtility.InstantiatePrefab(srcPrefab) as GameObject;

        GameObject newobj = RemoveMissingScript(obj.transform);
        int        i      = 10;

        while (i > 0)
        {
            //枝葉の末尾のみを修正するため、念の為に複数回実行して漏れを防ぐ
            i--;
            newobj = RemoveMissingScript(newobj.transform);
        }
        newobj.transform.parent = targetObject.transform;
        NgObject.SetActiveRecursively(newobj, false);
        return(newobj);
    }
    void CreateEffect()
    {
        if (m_EffectPrefabs[m_nIndex] == null)
        {
            return;
        }

        if (m_EffectGUIText != null)
        {
            m_EffectGUIText.text = m_EffectPrefabs[m_nIndex].name;
        }

        float fRandomRange = 0;

        if (1 < m_nCreateCount)
        {
            fRandomRange = m_fRandomRange;
        }

        for (int n = 0; n < GetInstanceRoot().transform.GetChildCount(); n++)
        {
            Destroy(GetInstanceRoot().transform.GetChild(n).gameObject);
        }
        for (int n = 0; n < m_nCreateCount; n++)
        {
            GameObject createObj = (GameObject)Instantiate(m_EffectPrefabs[m_nIndex], new Vector3(Random.Range(-fRandomRange, fRandomRange), 0, Random.Range(-fRandomRange, fRandomRange)), Quaternion.identity);
            createObj.transform.localScale = createObj.transform.localScale * m_fCreateScale;
            NcEffectBehaviour.PreloadTexture(createObj);
            createObj.transform.parent = GetInstanceRoot().transform;
#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
        }
    }
Beispiel #6
0
    public void SetCloneObject(int nCloneIndex, GameObject prefab)
    {
        // 기존 것 삭제
        if (m_ChildObjects[nCloneIndex] != null)
        {
            Object.DestroyImmediate(m_ChildObjects[nCloneIndex]);
            m_ChildObjects[nCloneIndex]        = null;
            m_CloneThumbFilenames[nCloneIndex] = "";
        }

        // 새로운 차일드 등록
        if (prefab != null)
        {
            m_ChildObjects[nCloneIndex] = NgAsset.LoadPrefab(prefab, gameObject);
            NgObject.SetActiveRecursively(m_ChildObjects[nCloneIndex], true);
            m_ChildObjects[nCloneIndex].name = m_ChildObjects[nCloneIndex].name.Replace("(Clone)", "");

            // 사용된 prefab과 GameObject를 선택한다.
            FXMakerAsset.SetPingObject(prefab, m_ChildObjects[nCloneIndex]);

            // thumb 출력을 위해서 원본prefab의 guid를 저장해 둔다.
            m_CloneThumbFilenames[nCloneIndex] = NgAsset.GetPrefabThumbFilename(prefab);
        }
        FXMakerBackground.inst.SaveBackgroundPrefab();
    }
Beispiel #7
0
    bool CreateCurrentInstanceEffect(GameObject gameObj)
    {
        NgUtil.LogDevelop("CreateCurrentInstanceEffect() - gameObj - " + gameObj);
        GameObject parentObj = GetInstanceRoot();

        // 이전거 삭제
        NgObject.RemoveAllChildObject(parentObj, true);

        // 새로 생성
        if (gameObj != null)
        {
            GameObject createObj = (GameObject)Instantiate(gameObj);
            NsEffectManager.PreloadResource(createObj);

            createObj.transform.parent = parentObj.transform;
            m_InstanceEffectObject     = createObj;
#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);
    }
Beispiel #8
0
	public void SetCurrentEffectPrefab(GameObject setPrefab, GameObject effectRoot, bool bUpdateOnlyPrefab)
	{
		if (m_bApplicationQuit)
			return;

		if (IsStartTooMain() || setPrefab == null)
			return;

		m_OriginalEffectPrefab	= setPrefab;
		if (bUpdateOnlyPrefab)
			return;

		NcEffectBehaviour.PreloadTexture(setPrefab);

		m_OriginalEffectObject	= NgAsset.LoadPrefab(setPrefab, effectRoot);
		m_OriginalEffectObject.name = m_OriginalEffectObject.name.Replace("(Clone)", "(Original)");
		NgObject.SetActiveRecursively(m_OriginalEffectObject, false);

		if (IsLoadingProject() == false)
			FXMakerAsset.SetPingObject(m_OriginalEffectObject);

		// EffectHierarchy
		if (GetFXMakerHierarchy() != null)
			GetFXMakerHierarchy().ShowHierarchy(m_OriginalEffectObject);
		// Create ShowObject
		CreateCurrentInstanceEffect(true);
	}
Beispiel #9
0
    public static GameObject CloneGameObject(GameObject srcObj)
    {
        GameObject newObj = NgObject.CreateGameObject(srcObj.transform.parent, srcObj);

        NgObject.SetActiveRecursively(newObj, false);
        newObj.name = newObj.name.Replace("(Clone)", "");
        return(newObj);
    }
Beispiel #10
0
    // ---------------------------------------------------------------------------
    void SetClipboardTransform(Transform selTrans)
    {
        m_CopyCloneObject = NgObject.CreateGameObject(gameObject.transform, selTrans.gameObject).transform;
        NgObject.SetActiveRecursively((m_CopyCloneObject as Transform).gameObject, false);
        ObjectCopy(selTrans, (m_CopyCloneObject as Transform), true);

        m_CopyCloneObject.name = m_CopyCloneObject.name.Replace("(Clone)", "");
        m_CopyCloneObject.name = m_CopyCloneObject.name.Replace("(Original)", "");
    }
    public static void HideNcDelayActive(GameObject tarObj)
    {
        NgObject.SetActiveRecursively(tarObj, false);

/*
 *              NcDelayActive[]	coms = tarObj.GetComponentsInChildren<NcDelayActive>(true);
 *              foreach (NcDelayActive com in coms)
 *                      com.CancelDelayActive();
 */
    }
    // Control Function -----------------------------------------------------------------
    void CreateAttachPrefab()
    {
        m_nCreateCount++;

        m_CreateGameObject = (GameObject)CreateGameObject(GetTargetGameObject(), (GetTargetGameObject() == gameObject ? null : transform), m_AttachPrefab);
        if (m_CreateGameObject == null)
        {
            return;
        }

        // sync Layer
//		Ng_ChangeLayerWithChild(m_CreateGameObject, gameObject.layer);

        // Random pos
        Vector3 newPos = m_CreateGameObject.transform.position;

        m_CreateGameObject.transform.position = new Vector3(Random.Range(-m_RandomRange.x, m_RandomRange.x) + newPos.x, Random.Range(-m_RandomRange.y, m_RandomRange.y) + newPos.y, Random.Range(-m_RandomRange.z, m_RandomRange.z) + newPos.z);

        // AddStartPos
        m_CreateGameObject.transform.position += m_AddStartPos;

        // m_AccumStartRot
        m_CreateGameObject.transform.localRotation *= Quaternion.Euler(m_AccumStartRot.x * m_nCreateCount, m_AccumStartRot.y * m_nCreateCount, m_AccumStartRot.z * m_nCreateCount);
        m_CreateGameObject.name += " " + m_nCreateCount;
        NgObject.SetActiveRecursively(m_CreateGameObject, true);

        // PrefabAdjustSpeed
        AdjustSpeedRuntime(m_CreateGameObject, m_fPrefabSpeed);

        // m_fPrefabLifeTime
        if (0 < m_fPrefabLifeTime)
        {
            NcAutoDestruct ncAd = m_CreateGameObject.GetComponent <NcAutoDestruct>();
            if (ncAd == null)
            {
                ncAd = m_CreateGameObject.AddComponent <NcAutoDestruct>();
            }
            ncAd.m_fLifeTime = m_fPrefabLifeTime;
        }

        // m_bDetachParent
        if (m_bDetachParent)
        {
            NcDetachParent detachCom = m_CreateGameObject.GetComponent <NcDetachParent>();
            if (detachCom == null)
            {
                detachCom = m_CreateGameObject.AddComponent <NcDetachParent>();
            }
        }

        if ((0 == m_fRepeatTime || m_AttachType == AttachType.Destroy) && 0 < m_nRepeatCount && m_nCreateCount < m_nRepeatCount)
        {
            CreateAttachPrefab();
        }
    }
    void CreateCloneObject()
    {
        if (m_ClonObject == null)
        {
            return;
        }

        GameObject createObj;

        if (transform.parent == null)
        {
            createObj = (GameObject)CreateGameObject(gameObject);
        }
        else
        {
            createObj = (GameObject)CreateGameObject(transform.parent.gameObject, m_ClonObject);
        }

#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_fDuplicateLifeTime
        if (0 < m_fDuplicateLifeTime)
        {
            NcAutoDestruct ncAd = createObj.GetComponent <NcAutoDestruct>();
            if (ncAd == null)
            {
                ncAd = createObj.AddComponent <NcAutoDestruct>();
            }
            ncAd.m_fLifeTime = m_fDuplicateLifeTime;
        }

        // Random pos
        Vector3 newPos = createObj.transform.position;
        createObj.transform.position = new Vector3(Random.Range(-m_RandomRange.x, m_RandomRange.x) + newPos.x, Random.Range(-m_RandomRange.y, m_RandomRange.y) + newPos.y, Random.Range(-m_RandomRange.z, m_RandomRange.z) + newPos.z);

        // AddStartPos
        createObj.transform.position += m_AddStartPos;

        // m_AccumStartRot
        createObj.transform.localRotation *= Quaternion.Euler(m_AccumStartRot.x * m_nCreateCount, m_AccumStartRot.y * m_nCreateCount, m_AccumStartRot.z * m_nCreateCount);
        createObj.name += " " + m_nCreateCount;

        m_nCreateCount++;
        if (m_bInvoke)
        {
            if (m_nDuplicateCount <= m_nCreateCount)
            {
                CancelInvoke("CreateCloneObject");
            }
        }
    }
Beispiel #14
0
    // 특정 prefab을 로드해서 target 밑으로 생성한다.
    public static GameObject LoadPrefab(string strPrefabPath, GameObject targetObject)
    {
        NgUtil.LogDevelop("LoadPrefab() - strPrefabPath - " + strPrefabPath);

        // 선택된 asset 로드 (project to Hierarchy)
        GameObject prefab = (GameObject)AssetDatabase.LoadAssetAtPath(strPrefabPath, typeof(GameObject));
        GameObject obj    = NgObject.CreateGameObject(targetObject, prefab);

        NgObject.SetActiveRecursively(obj, false);
//		gUtil.LogDevelop(AssetDatabase.GetAssetPath(prefab));
        return(obj);
    }
Beispiel #15
0
 private void OnMoveEnd()
 {
     this.m_fSpeed = 0f;
     NgObject.SetActiveRecursively(base.gameObject, false);
     if (1 < FxmTestSimulate.m_nMultiShotCreate && this.m_nMultiShotIndex < FxmTestSimulate.m_nMultiShotCreate - 1)
     {
         return;
     }
     if (this.m_FXMakerControls != null)
     {
         this.m_FXMakerControls.SendMessage("OnActionTransEnd");
     }
 }
Beispiel #16
0
    public static void SetActiveRecursively(GameObject target, bool bActive)
    {
        int num = target.transform.childCount - 1;

        while (0 <= num)
        {
            if (num < target.transform.childCount)
            {
                NgObject.SetActiveRecursively(target.transform.GetChild(num).gameObject, bActive);
            }
            num--;
        }
        target.SetActive(bActive);
    }
Beispiel #17
0
    // Event -------------------------------------------------------------------------
    void OnMoveEnd()
    {
        m_fSpeed = 0;

        NgObject.SetActiveRecursively(gameObject, false);
        if (1 < m_nMultiShotCreate && m_nMultiShotIndex < m_nMultiShotCreate - 1)
        {
            return;
        }
        if (m_FXMakerControls != null)
        {
            m_FXMakerControls.SendMessage("OnActionTransEnd", SendMessageOptions.DontRequireReceiver);
        }
    }
Beispiel #18
0
    public Object OverwriteClipboardObject(GameObject tarGameObject, Object tarComponent, int tarIndex)
    {
        if (IsGameObject())
        {
            // not used
            GameObject newObj = NgObject.CreateGameObject(m_CopyCloneObject as GameObject);
            NgObject.SetActiveRecursively(newObj, false);
            newObj.transform.parent = tarGameObject.transform;             // �����ִ�... �����ϹǷ� ���߿� ó��
            newObj.name             = newObj.name.Replace("(Clone)", "");
            newObj.name             = newObj.name.Replace("(Original)", "");
            return(newObj);
        }

        return(PasteObject(m_CopyCloneObject, true, tarGameObject.transform, tarComponent, tarIndex, false, false, false));
    }
Beispiel #19
0
    public static GameObject LoadPrefab(GameObject srcPrefab, GameObject targetObject)
    {
        string path = AssetDatabase.GetAssetPath(srcPrefab);

        NgUtil.LogDevelop("LoadPrefab() - strPrefabPath - " + path);

        // 선택된 asset 로드 (project to Hierarchy)
//      GameObject prefab	= (GameObject)AssetDatabase.LoadAssetAtPath(path, typeof(GameObject));
//		GameObject obj		= NgObject.CreateGameObject(targetObject, prefab);
        GameObject obj = PrefabUtility.InstantiatePrefab(srcPrefab) as GameObject;

        obj.transform.parent = targetObject.transform;

        NgObject.SetActiveRecursively(obj, false);
        return(obj);
    }
Beispiel #20
0
    private bool CreateCurrentInstanceEffect(GameObject gameObj)
    {
        NgUtil.LogDevelop("CreateCurrentInstanceEffect() - gameObj - " + gameObj);
        GameObject instanceRoot = this.GetInstanceRoot();

        NgObject.RemoveAllChildObject(instanceRoot, true);
        if (gameObj != null)
        {
            GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(gameObj);
            NcEffectBehaviour.PreloadTexture(gameObject);
            gameObject.transform.parent = instanceRoot.transform;
            this.m_InstanceEffectObject = gameObject;
            NgObject.SetActiveRecursively(gameObject, true);
            this.m_FXMakerControls.SetStartTime();
            return(true);
        }
        this.m_InstanceEffectObject = null;
        return(false);
    }
Beispiel #21
0
    public void ShowBackground(bool bShow)
    {
        for (int nIndex = 0; nIndex < m_ReferenceObjects.Length; nIndex++)
        {
            int nChildIndex = FXMakerBackground.m_CloneTypeCount + nIndex;

            // 기존 것 삭제
            if (m_ChildObjects[nChildIndex] != null)
            {
                Object.DestroyImmediate(m_ChildObjects[nChildIndex]);
                m_ChildObjects[nChildIndex] = null;
            }

            if (bShow && m_ReferenceObjects[nIndex] != null)
            {
                m_ChildObjects[nChildIndex]      = NgAsset.LoadPrefab(m_ReferenceObjects[nIndex], gameObject);
                m_ChildObjects[nChildIndex].name = m_ChildObjects[nChildIndex].name.Replace("(Clone)", "");
                NgObject.SetActiveRecursively(m_ChildObjects[nChildIndex], true);
            }
        }
    }
Beispiel #22
0
    // 특정폴더의 prefab을 로드해서 target 밑으로 생성한다.
    public static void LoadPrefabList(string strPrefabDir, GameObject targetObject)
    {
#if UNITY_WEBPLAYER
        Debug.LogError("In WEB_PLAYER mode, you cannot run the FXMaker.");
        Debug.Break();
        return;
#else
        if (strPrefabDir[strPrefabDir.Length - 1] != '/' && strPrefabDir[strPrefabDir.Length - 1] != '\\')
        {
            strPrefabDir = strPrefabDir + "/";
        }

        // load Current Group
        DirectoryInfo dir = new DirectoryInfo(strPrefabDir);

        // CheckDir
        if (dir.Exists == false)
        {
            Debug.LogError("Directory not found - " + strPrefabDir);
        }

        FileInfo[] info = dir.GetFiles();

        NgUtil.LogDevelop("BuildPrefabList() - LoadDir - " + strPrefabDir);
//		Object[]	objs	= AssetDatabase.LoadAllAssetsAtPath(loaddir);

        // 기존것 모두 삭제
        NgObject.RemoveAllChildObject(targetObject, true);

        // 선택된 그룹폴더 asset 로드 (project to Hierarchy)
        foreach (FileInfo fileInfo in info)
        {
            NgUtil.LogDevelop("BuildPrefabList() - FindFile - " + fileInfo.Name);
            GameObject prefab = (GameObject)AssetDatabase.LoadAssetAtPath(strPrefabDir + fileInfo.Name, typeof(GameObject));
            NgUtil.LogDevelop("BuildPrefabList() - " + prefab.name);
            GameObject obj = NgObject.CreateGameObject(targetObject, prefab);
            NgObject.SetActiveRecursively(obj, false);
        }
#endif
    }
Beispiel #23
0
    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);
    }
Beispiel #24
0
    void Update()
    {
        if (0 < m_fStartChangeTime)
        {
            if (0 < m_fChangeTime)
            {
                float fElapsedRate = ((GetEngineTime() - m_fStartChangeTime) / m_fChangeTime);
                if (1 < fElapsedRate)
                {
                    fElapsedRate = 1;
                    // m_bAutoDeactive
                    if (m_bAutoDeactive && m_fToMeshValue <= 0)
                    {
                        NgObject.SetActiveRecursively(gameObject, false);
                    }
                }
                ChangeToAlpha(fElapsedRate);
            }
            else
            {
                ChangeToAlpha(1);
            }
        }
        else
        {
            // Time
//          if (0 < m_fStartTime && m_fLifeTime != 0)
            if (0 < m_fStartTime)
            {
                if (m_fStartTime + m_fDelayTime <= GetEngineTime())
                {
                    StartChange();
                }
            }
        }
    }
Beispiel #25
0
    public GameObject[]    m_ReferenceObjects = new GameObject[FXMakerBackground.m_ReferenceTypeCount];                                         //  m_ModelPrefab1, m_ModelPrefab2,

    //	[HideInInspector]

    // Property -------------------------------------------------------------------------
    public void SetActive()
    {
        NgObject.SetActiveRecursively(gameObject, true);
    }