Example #1
0
        public void Deserialize(NetworkReader reader)
        {
            this.damage = reader.ReadDamageInfo();
            this.target = reader.ReadHurtBoxReference().ResolveHurtBox();
            Byte flags = reader.ReadByte();
            Byte mask  = (Byte)0b0000_0001u;

            this.callDamage   = (flags & mask) > 0;
            flags           >>= 1;
            this.callHitEnemy = (flags & mask) > 0;
            flags           >>= 1;
            this.callHitWorld = (flags & mask) > 0;
        }
Example #2
0
        public void Deserialize(NetworkReader reader)
        {
            _damage = reader.ReadDamageInfo();
            _target = reader.ReadHurtBoxReference().ResolveHurtBox();

            byte       flags = reader.ReadByte();
            const byte mask  = 0b0001;

            _callDamage   = (flags & mask) > 0;
            flags       >>= 1;
            _callHitEnemy = (flags & mask) > 0;
            flags       >>= 1;
            _callHitWorld = (flags & mask) > 0;
        }
Example #3
0
        private static void HandleBulletDamage(NetworkMessage netMsg)
        {
            NetworkReader reader     = netMsg.reader;
            GameObject    gameObject = reader.ReadGameObject();
            DamageInfo    damageInfo = reader.ReadDamageInfo();

            if (reader.ReadBoolean() && gameObject)
            {
                HealthComponent component = gameObject.GetComponent <HealthComponent>();
                if (component)
                {
                    component.TakeDamage(damageInfo);
                }
                GlobalEventManager.instance.OnHitEnemy(damageInfo, gameObject);
            }
            GlobalEventManager.instance.OnHitAll(damageInfo, gameObject);
        }