コード例 #1
0
        public async Task <GActor> CreateActor(Editor.PlantableItemCreateActorParam param, RName MacrossName)
        {
            var rc = EngineNS.CEngine.Instance.RenderContext;

            await EngineNS.Thread.AsyncDummyClass.DummyFunc();

            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;

            var init = new GParticleComponentInitializer();

            init.SpecialName = "ParticleData";
            init.MacrossName = MacrossName;
            await SetInitializer(rc, actor, actor, init);

            actor.AddComponent(this);

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

            meshCompInit.SpecialName = "EditorShow";
            meshCompInit.MeshName    = EngineNS.RName.GetRName("meshes/icon_particle.gms", EngineNS.RName.enRNameType.Editor);
            await meshComp.SetInitializer(rc, actor, actor, meshCompInit);

            meshComp.HideInGame = true;
            actor.AddComponent(meshComp);

            return(actor);
        }
コード例 #2
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);
        }
コード例 #3
0
        public async Task <Actor.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);

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

            meshCompInit.SpecialName = "EditorShow";
            meshCompInit.MeshName    = EngineNS.RName.GetRName("meshes/pointlight.gms", EngineNS.RName.enRNameType.Editor);
            await meshComp.SetInitializer(rc, actor, actor, meshCompInit);

            meshComp.HideInGame = true;
            actor.AddComponent(meshComp);

            meshComp                 = new EngineNS.GamePlay.Component.GMeshComponent();
            meshCompInit             = new EngineNS.GamePlay.Component.GMeshComponent.GMeshComponentInitializer();
            meshCompInit.SpecialName = "SphereVolumeShow";
            meshCompInit.MeshName    = EngineNS.RName.GetRName("meshes/sphere_wireframe.gms", EngineNS.RName.enRNameType.Editor);
            await meshComp.SetInitializer(rc, actor, actor, meshCompInit);

            meshComp.HideInGame = true;
            actor.AddComponent(meshComp);


            var initializer = new GPointLightComponentInitializer();

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

            actor.AddComponent(this);
            actor.AcceptLights = false;

            return(actor);
        }
コード例 #4
0
        public override async Task <GamePlay.Actor.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);

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

            meshCompInit.SpecialName = "EditorShow";
            meshCompInit.MeshName    = EngineNS.RName.GetRName("meshes/go_on.gms", EngineNS.RName.enRNameType.Editor);
            await meshComp.SetInitializer(rc, actor, actor, meshCompInit);

            meshComp.HideInGame                = true;
            meshComp.Placement.InheritScale    = false;
            meshComp.Placement.InheritRotation = false;
            actor.AddComponent(meshComp);

            var init = new BoxComponentInitializer();

            init.SpecialName = "NavMeshBoundVolume";
            await SetInitializer(rc, actor, actor, init);

            mLineMeshComponent.Host = actor;
            var mat = actor.Placement.WorldMatrix;

            mLineMeshComponent.OnUpdateDrawMatrix(ref mat);

            actor.AddComponent(this);

            return(actor);
        }