static private void CreateActorComponent(NActor newActor, NResourceLoc res) { try { switch (res.FileExtension) { case "nmdl": { NActorComponent comp = newActor.CreateComponent( MakeComponentName("StaticMesh_", res), "nstatic_mesh_component"); NStaticMeshComponent meshComp = comp as NStaticMeshComponent; meshComp.ResetResource(res); } break; case "spt": { NActorComponent comp = newActor.CreateComponent( MakeComponentName("SPTComp_", res), "nspeed_tree_component"); NSpeedTreeComponent sptComp = comp as NSpeedTreeComponent; sptComp.Create(res); } break; case "nam": { NActorComponent comp = newActor.CreateComponent( MakeComponentName("AnimMeshComp_", res), "nanim_mesh_component"); NAnimMeshComponent meshComp = comp as NAnimMeshComponent; meshComp.ResetResource(res); } break; }// end of switch } catch (System.Exception e) { NexusEditor.Program.ShowException(e, "Create Resource Actor Component FAILED!"); } }
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!"); } }