Exemplo n.º 1
0
    internal void setWorld(World world)
    {
        this.world = world;
        if (this.isControllable)
        {
            world.gui.AddChild(powerupClock);
        }

        hair.MoveToFront();
    }
Exemplo n.º 2
0
 public override void Update()
 {
     playerSprite.MoveToFront();
     base.Update();
 }
Exemplo n.º 3
0
            public void Update(float timeStacker)
            {
                if (displaySprite.container != cam.ReturnFContainer("HUD2"))
                {
                    cam.ReturnFContainer("HUD2").AddChild(displaySprite);
                }

                // Create a delegate that gets the current inputs
                if (_getInputs == null)
                {
                    Type rwInput = Type.GetType("RWInput, Assembly-CSharp");
                    _getInputs = (GetRTInputs)Delegate.CreateDelegate(typeof(GetRTInputs), rwInput.GetMethod("PlayerInput", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static));
                }

                // Move the input display when left bracket is pressed
                if (Input.GetKey(KeyCode.LeftBracket))
                {
                    origin = Input.mousePosition;
                    Move();
                }

                // Allow dragging the input display
                if (_dragging)
                {
                    if (!Input.GetMouseButton(0))
                    {
                        _dragging = false;
                    }
                    else
                    {
                        origin = (Vector2)Input.mousePosition + _dragOffset;
                        Move();
                    }
                }
                else
                {
                    if (Input.GetMouseButtonDown(0) && IsMouseOver)
                    {
                        _dragging   = true;
                        _dragOffset = origin - (Vector2)Input.mousePosition;
                    }
                }

                // Change the lerp bar to display the current timeStacker
                _lerpBar.scaleX = timeStacker * _lerpBarWidth;

                // Cache the inputs at the start of the frame. It is not going to change while the buttons are updating
                rtInput = _getInputs(0, cam.game.rainWorld.options, cam.game.rainWorld.setup);
                foreach (InputButton button in buttons)
                {
                    button.Update();
                }

                // Update the analog input
                Vector2 aiCenter  = new Vector2(DrawOrigin.x + _analogRelPos.x + _analogBoxSize * 0.5f - 0.5f, DrawOrigin.y + _analogRelPos.y + _analogBoxSize * 0.5f - 0.5f);
                float   maxOffset = _analogBoxSize * 0.5f - 4f;

                _analogIndicator.SetPosition(aiCenter + CurrentInput.analogueDir * maxOffset);
                _analogRTIndicator.SetPosition(aiCenter + rtInput.analogueDir * maxOffset);
                _analogRTIndicator.isVisible = !hideRTIndicators;

                displaySprite.MoveToFront();
                offscreenContainer.MoveToFront();
            }