public MapBuilderClient() : base()
        {
            _accessor = this;

            FreecamConfig config = new FreecamConfig
            {
                FieldOfView         = 75,
                PositionSensitivity = 1.0f,
                PositionBase        = 100.0f,
                RotationSensitivity = 1.0f,
                RotationBase        = 500.0f,
                KeySmoothTime       = 500,
            };

            input = locator.CreateService <Input>();
            //@TODO(bma) #state-manager: Move this to #move-toggle-to-class.
            input.RegisterKey(0, 37, InputKeyType.Once);
            input.RegisterKey(0, 261, InputKeyType.Once);
            input.RegisterKey(0, 262, InputKeyType.Once);

            freeCam = locator.CreateService <Freecam>(config);
            ui      = locator.CreateService <UserInterface>();
            builder = locator.CreateService <Builder>();

            EventHandlers.Add("onResourceStop", new Action <string>(OnResourceStopped));
        }
Beispiel #2
0
        public Freecam(FreecamConfig config)
        {
            var accessor = MapBuilderClient.Accessor;
            var locator  = MapBuilderClient.Locator;

            Config = config;

            inputRef = locator.GetServiceReference <Input>();
            var input = inputRef.Get();

            input.RegisterKey(0, 32, InputKeyType.Continuous);
            input.RegisterKey(0, 33, InputKeyType.Continuous);
            input.RegisterKey(0, 34, InputKeyType.Continuous);
            input.RegisterKey(0, 35, InputKeyType.Continuous);
            input.RegisterKey(0, 52, InputKeyType.Continuous);
            input.RegisterKey(0, 54, InputKeyType.Continuous);

            camera = new FreecamCamera(this);

            accessor.OnRenderTick(Freecam_Update);
            accessor.OnRenderTick(Freecam_UpdateCamera);
        }