示例#1
0
    private void AppendName(Mouledoux.Callback.Packet a_packet)
    {
        var packet = new Mouledoux.Callback.Packet();

        packet.strings = new string[] { gameObject.name + ", " };
        object[] data = { packet };
        Mouledoux.Components.Mediator.instance.NotifySubscribers("appendbigtext", data);
    }
示例#2
0
    public void NotActive()
    {
        var packet = new Mouledoux.Callback.Packet();

        packet.ints = new int[] { gameObject.GetInstanceID() };
        object[] data = { packet };
        Mouledoux.Components.Mediator.instance.NotifySubscribers("nolongeractive", data);
    }
示例#3
0
    public void IncreaseScore()
    {
        var packet = new Mouledoux.Callback.Packet();

        packet.floats = new float[] { m_scoreValue };
        packet.bools  = new bool[] { false };
        object[] data = { packet };
        Mouledoux.Components.Mediator.instance.NotifySubscribers("incrementcurrentscore", data);
    }
示例#4
0
    public void InputDirection(Mouledoux.Callback.Packet packet)
    {
        float direction = packet.floats[4] > 0.5f ? packet.floats[4] : 0f;

        direction += packet.floats[5] < -0.5f ? packet.floats[4] : 0f;

        transform.RotateAround(transform.position, transform.forward, -direction * 4f);

        Physics2D.gravity = -transform.up * 10f;
    }
示例#5
0
    public void NextRailPoint()
    {
        currentPoint++;
        //TurnOffOtherZones();
        if (currentPoint >= railPoints.Count - 1)
        {
            currentPoint = railPoints.Count - 1;
            Mouledoux.Components.Mediator.instance.NotifySubscribers("setreview");
            StartTeleport(railPoints[currentPoint]);
            return;
        }

        var pack = new Mouledoux.Callback.Packet();

        pack.ints = new int[] { currentPoint };
        object[] data = { pack };
        Mouledoux.Components.Mediator.instance.NotifySubscribers("teleporting", data);
        StartTeleport(railPoints[currentPoint]);
    }
示例#6
0
    private void InputExternalGravityControl(Mouledoux.Callback.Packet packet)
    {
        if (!packet.bools[2] || packet.floats[4] < 0.1f)
        {
            return;
        }

        if (m_target != null)
        {
            m_target = null;
            return;
        }

        RaycastHit2D rayHit = Physics2D.Raycast(transform.position, transform.right);

        if (rayHit.transform.GetComponent <Rigidbody2D>() == null)
        {
            return;
        }
        m_target = rayHit.transform.GetComponent <Rigidbody2D>();
    }
示例#7
0
    private void InputGlobalGravity(Mouledoux.Callback.Packet packet)
    {
        if (packet.bools[9])
        {
            Utilities.globalGravity = Vector3.zero;
            return;
        }
        else if (packet.floats[4] > 0.1f)
        {
            return;
        }

        Vector2 rightStick = new Vector2(packet.floats[2], packet.floats[3]);

        if (rightStick.magnitude > 0.01f)
        {
            Utilities.globalGravity += (Vector3)
                                       (rightStick *
                                        (10f + Utilities.globalGravity.magnitude) *
                                        Time.deltaTime);
        }
    }
示例#8
0
    private void GetControllerInput()
    {
        leftStick  = GetJoystickInput("Left");
        rightStick = GetJoystickInput("Right");

        leftTrigger  = GetTriggerInput("Left");
        rightTrigger = GetTriggerInput("Right");

        buttonA     = Input.GetKeyDown(KeyCode.JoystickButton0);
        buttonB     = Input.GetKeyDown(KeyCode.JoystickButton1);
        buttonX     = Input.GetKeyDown(KeyCode.JoystickButton2);
        buttonY     = Input.GetKeyDown(KeyCode.JoystickButton3);
        leftBumper  = Input.GetKeyDown(KeyCode.JoystickButton4);
        rightBumper = Input.GetKeyDown(KeyCode.JoystickButton5);

        rightStickClick = Input.GetKeyDown(KeyCode.JoystickButton9);

        joysticks[0] = leftStick.x;
        joysticks[1] = leftStick.y;
        joysticks[2] = rightStick.x;
        joysticks[3] = rightStick.y;
        joysticks[4] = leftTrigger;
        joysticks[5] = rightTrigger;


        buttons[0] = buttonA;
        buttons[1] = buttonB;
        buttons[2] = buttonX;
        buttons[3] = buttonY;
        buttons[4] = leftBumper;
        buttons[5] = rightBumper;
        buttons[9] = rightStickClick;


        Mouledoux.Callback.Packet inputData =
            new Mouledoux.Callback.Packet(new int[0], buttons, joysticks, new string[0]);

        Mouledoux.Components.Mediator.instance.NotifySubscribers("input", inputData);
    }
示例#9
0
    private void InputMove(Mouledoux.Callback.Packet packet)
    {
        Vector2 velocity = Vector2.zero;

        Vector2 leftStick = new Vector2(packet.floats[0], packet.floats[1]);
        bool    buttonA   = packet.bools[0];
        bool    buttonB   = packet.bools[1];

        velocity.x += leftStick.x * speed * (m_airborn ? 0.25f : 1f);
        velocity.y += buttonA && m_jumpsLeft > 0 ? m_jumpStrength :
                      buttonB && m_jumpsLeft > 0 ? -m_jumpStrength * 2f : -1;
        m_jumpsLeft -= buttonA || buttonB ? 1 : 0;

        velocity  = transform.TransformDirection(velocity);
        velocity *= Utilities.timeScale;

        UpdateRigidPhysics();

        //m_rigidbody.AddForce(velocity);
        //m_rigidbody.AddForce(Utilities.globalGravity * Utilities.timeScale);

        ResetRigidhysics();
    }
示例#10
0
 private void InvokeUnityEvent(Mouledoux.Callback.Packet emptyPacket)
 {
     m_event.Invoke();
 }
示例#11
0
 protected void OffInteract(Mouledoux.Callback.Packet packet)
 {
     m_offInteract.Invoke();
 }
示例#12
0
 protected void OffHighlight(Mouledoux.Callback.Packet packet)
 {
     m_offHighnight.Invoke();
 }
示例#13
0
 public void ScrubAnimation(Mouledoux.Callback.Packet packet)
 {
     ScrubAnimation(packet.floats[0]);
 }
示例#14
0
 private void InputTime(Mouledoux.Callback.Packet packet)
 {
     Utilities.timeScale = (packet.bools[0] ? 0.1f : 1.0f);
 }
示例#15
0
    private void InputDirection(Mouledoux.Callback.Packet packet)
    {
        Vector2 direction = Camera.main.transform.up.normalized;

        transform.up = Vector3.Lerp(transform.up, direction, Time.deltaTime * m_speed);
    }
示例#16
0
 public void SetFlowRate(Mouledoux.Callback.Packet packet)
 {
     SetFlowRate(packet.floats[0]);
 }