示例#1
0
        public Ball(World world)
        {
            this.world = world;

            location = new Vector3(-2, -2, -2);

            physics = new PhysicsComponent();
            physics.velocity = Vector3.Zero;
            physics.collisionObject.collisionBox = new CollisionBox();
            physics.collisionObject.collisionBox.size = new Vector3(half, half, half);
            physics.collisionObject.collisionBox.offset = new Vector3(0, 0, 0);

            camera = new CameraComponent();

            AddComponent(physics);
            AddComponent(camera);
        }
示例#2
0
        public Player(World world)
        {
            this.world = world;

            location = new Vector3(-2, -2, -2);

            physics = new PhysicsComponent();
            physics.velocity = Vector3.Zero;
            physics.collisionObject.collisionBox = new CollisionBox();
            physics.collisionObject.collisionBox.size = new Vector3(0.4f, 0.9f, 0.4f);
            physics.collisionObject.collisionBox.offset = new Vector3(0, -0.3f, 0);
            physics.flying = true;

            input = new InputComponent();
            input.Keypress += (e) => {
                Keypress(e.key);
            };
            input.Keydown += (e) => {
                Keydown(e.key);
            };
            input.Keyup += (e) => {
                Keyup(e.key);
            };

            camera = new CameraComponent();
            camera.MakeActive();

            target = new TargetblockComponent();
            target.LinkDependency(camera, out target.camera);

            AddComponent(physics);
            AddComponent(input);
            AddComponent(camera);
            AddComponent(target);
            AddComponent(new WorldloaderComponent());
        }
 public void MakeActive()
 {
     activeCamera = this;
 }