예제 #1
0
        private void CreateLeapRoot()
        {
            string leapTempletePath = GamingMapEditorUtility.GetLeapTempletePath();

            if (string.IsNullOrEmpty(leapTempletePath))
            {
                return;
            }
            GameObject leapTemplete = AssetDatabase.LoadAssetAtPath <GameObject>(leapTempletePath);

            if (leapTemplete != null)
            {
                GameObject leapRootObj = GameObject.Instantiate(leapTemplete);
                leapRootObj.name = "LeapRoot";
                leapRootObj.transform.SetParent(transform);
                leapRootObj.transform.localPosition = Vector3.zero;
                leapRootObj.transform.localRotation = Quaternion.identity;
                m_LeapRoot = leapRootObj.AddComponent <LeapRoot>();
            }
        }
예제 #2
0
        /// <summary>
        /// 创建跃迁点
        /// </summary>
        /// <param name="root"></param>
        /// <returns></returns>
        private Leap CreateLeap(LeapRoot root)
        {
            Leap   leap             = null;
            string leapTempletePath = GamingMapEditorUtility.GetLeapTempletePath();

            if (string.IsNullOrEmpty(leapTempletePath))
            {
                return(leap);
            }

            GameObject leapTemplete = AssetDatabase.LoadAssetAtPath <GameObject>(leapTempletePath);

            if (leapTemplete != null)
            {
                GameObject leapRootObj = GameObject.Instantiate(leapTemplete);
                leapRootObj.name = root.m_LeapName;
                leapRootObj.transform.SetParent(transform);
                leapRootObj.transform.localPosition = Vector3.zero;
                leapRootObj.transform.localRotation = Quaternion.identity;
                leap          = leapRootObj.AddComponent <Leap>();
                leap.m_LeapId = root.m_LeapId;
            }
            return(leap);
        }