示例#1
0
        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));
        }
        //@TODO(bma): Some of the props have different anchor points, can we back this into the metadata some how?
        private async Task BuildObjectManager_UpdateProp()
        {
            if (!HasPropSelected)
            {
                await Task.FromResult(0);

                return;
            }

            Profiler.Enter("BuildObjectManager_UpdateProp");

            Freecam freecam       = camera.Get();
            Camera  freecamNative = freecam.GetNativeCamera();

            RaycastResult result = freecam.GetLookat(currentProp);

            if (result.DitHit)
            {
                PlaceCurrentPropOnGround(result.HitPosition);
            }
            else
            {
                PlaceCurrentPropInfrontOfCamera(freecamNative);
            }


            Profiler.Exit();
        }
示例#3
0
        public override void OnStateEnter()
        {
            //@TODO(bma) #input: Can we _not_ register_ every key we need and assign this dynamically? Making it a bit more friendly to use.
            Input input = MapBuilderClient.Locator.GetService <Input>();

            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);

            _freecam = new Freecam
            {
                KeySmoothing     = 500,
                MouseSensitivity = 1.0f,
                KeySensitivity   = 1.0f
            };

            _freecam.EnableFreecam();
        }
示例#4
0
 public FreecamCamera(Freecam freecam)
 {
     this.freecam = freecam;
 }
示例#5
0
 public FreecamCamera(Freecam self)
 {
     this.self = self;
 }