コード例 #1
0
        public void SendTrigger(Enum_Trigger trigger)
        {
            var msg = new Message(Enum_Action.Trigger);

            msg.AddData((byte)trigger);
            byte error;

            NetworkTransport.Send(_mHostId, _mConnectionId, _reliableChannel, msg.GetBuffer(), msg.GetSize(), out error);
        }
コード例 #2
0
    // when trigger is removed subtract 1 from counter.
    /// <summary>
    /// when trigger is removed subtract 1 from counter.
    /// </summary>
    /// <param name="trigger">the trigger which has been removed</param>
    public void CountdownTrigger(Enum_Trigger trigger)
    {
        switch (trigger)
        {
        case Enum_Trigger.Klappen:
            TriggerCounterMobile.DecreaseKlappen();
            break;

        case Enum_Trigger.Springen:
            TriggerCounterMobile.DecreaseSpringen();
            break;

        case Enum_Trigger.Wave:
            TriggerCounterMobile.DecreaseWave();
            break;
        }
    }
コード例 #3
0
    /// <summary>
    /// Checks which of the counted gestures is the highest.
    /// </summary>
    /// <param name="trigger"></param>
    /// <returns> the Enum_Trigger which has the highest counter</returns>
    private Enum_Trigger checkKlappenWave(Enum_Trigger trigger)
    {
        var result = trigger;

        if (TriggerCounterMobile.Klappen > TriggerCounterMobile.Wave)
        {
            result = Enum_Trigger.Klappen;
        }
        else if (TriggerCounterMobile.Wave > TriggerCounterMobile.Klappen)
        {
            result = Enum_Trigger.Wave;
        }
        else if (result == Enum_Trigger.Springen)
        {
            result = Enum_Trigger.Springen;
        }
        Debug.Log(result.ToString());
        return(result);
    }
コード例 #4
0
    /// <summary>
    /// add trigger to queue and add 1 to triggerCounter.
    /// </summary>
    /// <param name="trigger"> the detected trigger </param>
    public void ProcessTrigger(Enum_Trigger trigger)
    {
        var correctTrigger = checkKlappenWave(trigger);

        serverConnection.SendTrigger(correctTrigger);

        triggersFiFo.Enqueue(new KeyValuePair <double, Enum_Trigger>(Time.time, trigger));

        switch (trigger)
        {
        case Enum_Trigger.Klappen:
            TriggerCounterMobile.IncreaseKlappen();
            break;

        case Enum_Trigger.Springen:
            TriggerCounterMobile.IncreaseSpringen();
            break;

        case Enum_Trigger.Wave:
            TriggerCounterMobile.IncreaseWave();
            break;
        }
    }