/// <summary>
        /// new terrain菜单响应
        /// </summary>
        /// <remarks>
        /// 向Level中创建一个新的Terrrain,并自动打开Terrain编辑模式
        /// </remarks>
        private void newTerrainToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NewTerrainDlg dlg = new NewTerrainDlg();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                NETerrainProp trnProp = dlg.TerrainProperty;

                NLevel        mainLv   = NLevelEditorEngine.Instance.MainLevel;
                NActor        newActor = mainLv.CreateActor(trnProp.Name, "nterrain_actor");
                NTerrainActor newTrn   = newActor as NTerrainActor;

                newTrn.Create(trnProp.Width, trnProp.Height, trnProp.Init, trnProp.ChunkSize);
                newTrn.Move(trnProp.Position, trnProp.Scale);

                //-- 创建材质
                NewTerrainMaterial mtlDlg = new NewTerrainMaterial(newTrn);
                mtlDlg.Show(this);

                //-- 自动选中地形对象
                NLevelEditorEngine.Instance.ActorEd.SelectedActor = newTrn;

                this.RefreshViewports();
            }// end of if
        }
        public void LoadSpeedTree(NResourceLoc loc)
        {
            m_level.DestroyAllActors();

            //--
            try
            {
                NActor sptActor             = m_level.CreateActor("SptPreviewActor", "nactor");
                NSpeedTreeComponent sptComp = sptActor.CreateComponent("SPTComp", "nspeed_tree_component") as NSpeedTreeComponent;
                sptComp.Create(loc);

                sptActor.Scale = new Vector3(50, 50, 50);
                m_actorBox     = sptComp.GetBoundingBox();

                //-- add default light
                AddDefaultLight();

                m_resActorComp = sptComp;
            }
            catch (System.Exception e)
            {
                NexusEditor.Program.ShowException(e, "Speed Tree Load FAILED!");
            }
        }
Beispiel #3
0
        static public NActor CreateActor(List <NResourceLoc> resList)
        {
            string actorName = "ResourceActor_";

            actorName += DateTime.Now.ToFileTime();

            NLevel mainLv   = NLevelEditorEngine.Instance.MainLevel;
            NActor newActor = mainLv.CreateActor(actorName, "nactor");

            foreach (NResourceLoc res in resList)
            {
                CreateActorComponent(newActor, res);
            }

            return(newActor);
        }
Beispiel #4
0
        static public NActor CreateActor(NResourceLoc resLoc)
        {
            string actorName = resLoc.FileExtension.ToUpper() + "_ResActor[" + resLoc.FileName + "]";

            actorName += DateTime.Now.Ticks.ToString();

            NLevel mainLv   = NLevelEditorEngine.Instance.MainLevel;
            NActor newActor = mainLv.CreateActor(actorName, "nactor");

            if (newActor == null)
            {
                return(null);
            }
            CreateActorComponent(newActor, resLoc);

            return(newActor);
        }
Beispiel #5
0
        /// <summary>
        /// 创建Actor对象
        /// </summary>
        public NActor CreateActor(NLevel level, Vector3 location, Vector3 rotation)
        {
            if (string.IsNullOrEmpty(nativeActorClassName))
            {
                return(null);
            }

            string actorName = this.GetType().Name + "_" + DateTime.Now.ToFileTime();
            NActor newActor  = level.CreateActor(actorName, nativeActorClassName);

            if (newActor != null)
            {
                PostCreateActor(newActor);
                newActor.Location = location;
                newActor.Rotation = rotation;
            }

            return(newActor);
        }