Пример #1
0
    public static PlaySoundMessage Send(GameObject recipient, string sndName, Vector3 pos, float pitch,
                                        bool polyphonic  = false,
                                        bool shakeGround = false, byte shakeIntensity = 64, int shakeRange = 30, GameObject sourceObj = null)
    {
        var netId = NetId.Empty;

        if (sourceObj != null)
        {
            var netB = sourceObj.GetComponent <NetworkBehaviour>();
            if (netB != null)
            {
                netId = netB.netId;
            }
        }

        PlaySoundMessage msg = new PlaySoundMessage
        {
            SoundName      = sndName,
            Position       = pos,
            Pitch          = pitch,
            ShakeGround    = shakeGround,
            ShakeIntensity = shakeIntensity,
            ShakeRange     = shakeRange,
            Polyphonic     = polyphonic,
            TargetNetId    = netId
        };

        msg.SendTo(recipient);

        return(msg);
    }
Пример #2
0
    public static PlaySoundMessage Send(GameObject recipient, string sndName, Vector3 pos, float pitch,
                                        bool shakeGround = false, byte shakeIntensity = 64, int shakeRange = 30)
    {
        PlaySoundMessage msg = new PlaySoundMessage
        {
            SoundName      = sndName,
            Position       = pos,
            Pitch          = pitch,
            ShakeGround    = shakeGround,
            ShakeIntensity = shakeIntensity,
            ShakeRange     = shakeRange
        };

        msg.SendTo(recipient);

        return(msg);
    }