예제 #1
0
        public async Task <GActor> CreateActor(Editor.PlantableItemCreateActorParam param)
        {
            await EngineNS.Thread.AsyncDummyClass.DummyFunc();

            var rc = EngineNS.CEngine.Instance.RenderContext;

            var actor = new EngineNS.GamePlay.Actor.GActor();

            actor.ActorId = Guid.NewGuid();
            var placement = new EngineNS.GamePlay.Component.GPlacementComponent();

            actor.Placement    = placement;
            placement.Location = param.Location;
            placement.Rotation = EngineNS.Quaternion.GetQuaternion(Vector3.UnitZ, -Vector3.UnitY);
            actor.SpecialName  = "SunActor";

            var initializer = new GDirLightComponentInitializer();

            initializer.SpecialName = "LightData";
            await SetInitializer(rc, actor, actor, initializer);

            this.View = param.View;

            var meshComp     = new EngineNS.GamePlay.Component.GMeshComponent();
            var meshCompInit = new EngineNS.GamePlay.Component.GMeshComponent.GMeshComponentInitializer();

            meshCompInit.SpecialName = "VisualMesh";
            meshCompInit.MeshName    = EngineNS.RName.GetRName("editor/sun.gms", EngineNS.RName.enRNameType.Game);
            var test = meshComp.SetInitializer(rc, actor, actor, meshCompInit);

            actor.AddComponent(meshComp);

            actor.AddComponent(this);
            return(actor);
        }
예제 #2
0
        public override async System.Threading.Tasks.Task <bool> SetInitializer(CRenderContext rc, IEntity host, IComponentContainer hostContainer, GComponentInitializer v)
        {
            await base.SetInitializer(rc, host, hostContainer, v);

            DirLightInitializer = v as GDirLightComponentInitializer;
            return(true);
        }