Exemple #1
0
    /// <summary>
    /// <summary>Read Double from message. Don't forget read user id first (long)</summary>
    /// </summary>
    /// <param name="msg"></param>
    /// <returns></returns>
    public SharingData ReadDouble(NetworkInMessage msg, bool onlyValue = false)
    {
        long   userId = 0;
        string tag    = "";

        // firstly we read user_id and message tag if onlyValue == false
        ReadIdAndTag(msg, onlyValue, out userId, out tag);

        var value = msg.ReadDouble(); // lastly we read value

        return(new SharingData(userId, tag, value));
    }
    //Function that provides Haptic Feedback
    void HapticFeedback(NetworkInMessage msg)
    {
        Debug.Log("Get Threshold Data");
        msg.ReadInt64();
        double volumeScale = msg.ReadDouble();

        Debug.Log("Subpack should start vibrating");
        AudioSource source;

        source = GetComponent <AudioSource>();
        source.PlayOneShot(hapticSound, (float)volumeScale);
    }
Exemple #3
0
 public double ReadSize(NetworkInMessage msg)
 {
     return(msg.ReadDouble());
 }