Esempio n. 1
0
    private void OnReportCollision(NetStream stream)
    {
        float   impulse = NetFloat.Dequantize(stream.ReadInt32(10), 10000f, 11);
        Vector3 b       = NetVector3.Read(stream, 3, 10).Dequantize(100f);
        Vector3 pos     = base.transform.position + b;

        bag.ReportCollision(impulse, pos);
    }
Esempio n. 2
0
    private void ShatterNet(NetState netState)
    {
        shattered = true;
        Vector3 contactPoint    = DequantizePos(netState.shatterPos);
        float   impactMagnitude = NetFloat.Dequantize((int)netState.shatterMagnitude, 10000f, 11);
        uint    shatterSeed     = netState.shatterSeed;

        Shatter(contactPoint, Vector3.zero, impactMagnitude, shatterSeed, netState.netId);
    }
Esempio n. 3
0
        private void OnImpact(NetStream stream)
        {
            if (showDebug)
            {
                Debug.Log(base.name + " Impact ");
            }
            float impact = AudioUtils.DBToValue(NetFloat.Dequantize(stream.ReadInt32(6), 64f, 6) - 32f);

            PlayImpact(impact);
        }
        public void OnReceiveCollisionAudio(NetStream stream)
        {
            if (showDebug)
            {
                Debug.Log(base.name + " Recieve Collision Audio ");
            }
            ushort                  libId   = (ushort)stream.ReadUInt32(8);
            AudioChannel            channel = (!stream.ReadBool()) ? (stream.ReadBool() ? AudioChannel.Body : AudioChannel.Physics) : AudioChannel.Footsteps;
            Vector3                 b       = NetVector3.Read(stream, 3, 10).Dequantize(100f);
            Vector3                 pos     = base.transform.position + b;
            float                   emit    = AudioUtils.DBToValue(NetFloat.Dequantize(stream.ReadInt32(6), 64f, 6) - 32f);
            float                   num     = AudioUtils.CentsToRatio(NetFloat.Dequantize(stream.ReadInt32(3, 8), 4800f, 8));
            CollisionAudioHitConfig config  = CollisionAudioEngine.instance.GetConfig(libId);

            if (config != null)
            {
                if (showDebug)
                {
                    Debug.Log(base.name + " There is no audio engine ");
                }
                config.PlayWithKnownEmit(channel, null, pos, emit, num);
            }
        }