Exemplo n.º 1
0
        public override async Task <bool> SetInitializer(CRenderContext rc, GamePlay.IEntity host, GamePlay.Component.IComponentContainer hostContainer, GComponentInitializer v)
        {
            if (await base.SetInitializer(rc, host, hostContainer, v) == false)
            {
                return(false);
            }

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

            meshCompInit.SpecialName = "VisualMesh";
            meshCompInit.MeshName    = CEngineDesc.PlayerStartMesh;
            await mMeshComponent.SetInitializer(rc, Host, Host, meshCompInit);

            //var mat = host.Placement.WorldMatrix;
            //mMeshComponent.OnUpdateDrawMatrix(ref mat);

            AgentGeomBoxInitializer = v as AgentGeomBoxComponentInitializer;
            if (AgentGeomBoxInitializer != null)
            {
                AgentGridSize = AgentGeomBoxInitializer.AgentGridSize;
                StartPos      = AgentGeomBoxInitializer.StartPos;
            }
            else
            {
                AgentGeomBoxInitializer = new AgentGeomBoxComponentInitializer();
            }

            return(true);
        }
Exemplo n.º 2
0
        public override async Task <GActor> CreateActor(PlantableItemCreateActorParam param)
        {
            await EngineNS.Thread.AsyncDummyClass.DummyFunc();

            var rc = EngineNS.CEngine.Instance.RenderContext;

            var actorInit = new GActor.GActorInitializer();

            actorInit.InPVS = false;
            var actor = new GActor();

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

            actor.Placement    = placement;
            placement.Location = param.Location;

            var init = new AgentGeomBoxComponentInitializer();

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

            actor.AddComponent(this);
            return(actor);
        }
Exemplo n.º 3
0
        public override async Task <bool> SetInitializer(CRenderContext rc, GActor host, GComponentInitializer v)
        {
            if (await base.SetInitializer(rc, host, v) == false)
            {
                return(false);
            }

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

            meshCompInit.SpecialName = "VisualMesh";
            meshCompInit.MeshName    = RName.GetRName("editor/icon/icon_3D/mesh/play_start.gms", RName.enRNameType.Game);
            await mMeshComponent.SetInitializer(rc, Host, meshCompInit);

            //var mat = host.Placement.WorldMatrix;
            //mMeshComponent.OnUpdateDrawMatrix(ref mat);

            Initializer = v as AgentGeomBoxComponentInitializer;
            if (Initializer != null)
            {
                AgentGridSize = Initializer.AgentGridSize;
                StartPos      = Initializer.StartPos;
            }
            else
            {
                Initializer = new AgentGeomBoxComponentInitializer();
            }

            return(true);
        }