예제 #1
0
        public MainBase()
        {
            Health = 100;
            Size   = 8;

            ProceduralCube shape = new ProceduralCube();

            shape.Scale(Size);
            shape.SetColor(Color.Blue);
            AddComponent(new RenderGeometryComponent(BufferBuilder.VertexBufferBuild(shape),
                                                     BufferBuilder.IndexBufferBuild(shape), shape.PrimitiveCount));
            AddComponent(new EffectRenderComponent(EffectLoader.LoadSM5Effect("flatshaded")));
            AddComponent(new ShadowCasterComponent());
            var physicsComponent = new PhysicsComponent(false, false, PhysicsMeshType.box);

            AddComponent(physicsComponent);

            SystemCore.GameObjectManager.AddAndInitialiseGameObject(this);
            GetComponent <PhysicsComponent>().PhysicsEntity.CollisionInformation.Events.DetectingInitialCollision += Events_DetectingInitialCollision;
        }
예제 #2
0
        protected override void Initialise()
        {
            ProceduralCube playerShape = new ProceduralCube();

            playerShape.Scale(5f);

            AddComponent(new RenderGeometryComponent(BufferBuilder.VertexBufferBuild(playerShape),
                                                     BufferBuilder.IndexBufferBuild(playerShape), playerShape.PrimitiveCount));

            AddComponent(new EffectRenderComponent(EffectLoader.LoadSM5Effect("flatshaded")));

            AddComponent(new PhysicsComponent(true, false, PhysicsMeshType.box));

            Name = "player";


            AddComponent(new TopDownMouseAndKeyboardController());
            SystemCore.GameObjectManager.AddAndInitialiseGameObject(this);
            physicsComponent = GetComponent <PhysicsComponent>();
            base.Initialise();
        }