예제 #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]);
 }