예제 #1
0
        private bool SilentAim(Character localCharacter, Character targetCharacter)
        {
            HumanController component           = localCharacter.GetComponent <HumanController>();
            InventoryItem   currentEquippedItem = HackLocal.GetCurrentEquippedItem(component);

            if (currentEquippedItem == null)
            {
                return(false);
            }
            uLink.BitStream bitStream = new uLink.BitStream(false);
            if (currentEquippedItem is BulletWeaponItem <BulletWeaponDataBlock> )
            {
                BulletWeaponItem <BulletWeaponDataBlock> bulletWeaponItem = currentEquippedItem as BulletWeaponItem <BulletWeaponDataBlock>;
                bitStream.WriteByte(9);
                bitStream.Write <NetEntityID>(NetEntityID.Get(targetCharacter), new object[0]);
                bitStream.WriteVector3(targetCharacter.transform.position);
                bulletWeaponItem.itemRepresentation.ActionStream(1, uLink.RPCMode.Server, bitStream);
            }
            else
            {
                if (currentEquippedItem is BowWeaponItem <BowWeaponDataBlock> )
                {
                    BowWeaponItem <BowWeaponDataBlock> bowWeaponItem = currentEquippedItem as BowWeaponItem <BowWeaponDataBlock>;
                    bitStream.Write <NetEntityID>(NetEntityID.Get(targetCharacter), new object[0]);
                    bitStream.Write <Vector3>(targetCharacter.transform.position, new object[0]);
                    bowWeaponItem.itemRepresentation.ActionStream(2, uLink.RPCMode.Server, bitStream);
                }
                else
                {
                    if (!(currentEquippedItem is BulletWeaponItem <ShotgunDataBlock>))
                    {
                        return(false);
                    }
                    BulletWeaponItem <ShotgunDataBlock> bulletWeaponItem2 = currentEquippedItem as BulletWeaponItem <ShotgunDataBlock>;
                    for (int i = 0; i < bulletWeaponItem2.datablock.numPellets; i++)
                    {
                        bitStream.WriteByte(9);
                        bitStream.Write <NetEntityID>(NetEntityID.Get(targetCharacter), new object[0]);
                        bitStream.WriteVector3(targetCharacter.transform.position);
                    }
                    bulletWeaponItem2.itemRepresentation.ActionStream(1, uLink.RPCMode.Server, bitStream);
                }
            }
            return(true);
        }
예제 #2
0
        private bool SilentAim(Character localCharacter, Character targetCharacter)
        {
            InventoryItem currentEquippedItem = Local.GetCurrentEquippedItem(localCharacter.GetComponent <HumanController>());

            if (currentEquippedItem == null)
            {
                return(false);
            }
            uLink.BitStream stream = new uLink.BitStream(false);
            if (currentEquippedItem is BulletWeaponItem <BulletWeaponDataBlock> )
            {
                BulletWeaponItem <BulletWeaponDataBlock> item2 = currentEquippedItem as BulletWeaponItem <BulletWeaponDataBlock>;
                stream.WriteByte(9);
                stream.Write <NetEntityID>(NetEntityID.Get((UnityEngine.MonoBehaviour)targetCharacter), new object[0]);
                stream.WriteVector3(targetCharacter.transform.position);
                item2.itemRepresentation.ActionStream(1, uLink.RPCMode.Server, stream);
            }
            else if (currentEquippedItem is BowWeaponItem <BowWeaponDataBlock> )
            {
                BowWeaponItem <BowWeaponDataBlock> item3 = currentEquippedItem as BowWeaponItem <BowWeaponDataBlock>;
                stream.Write <NetEntityID>(NetEntityID.Get((UnityEngine.MonoBehaviour)targetCharacter), new object[0]);
                stream.Write <Vector3>(targetCharacter.transform.position, new object[0]);
                item3.itemRepresentation.ActionStream(2, uLink.RPCMode.Server, stream);
            }
            else
            {
                if (!(currentEquippedItem is BulletWeaponItem <ShotgunDataBlock>))
                {
                    return(false);
                }
                BulletWeaponItem <ShotgunDataBlock> item4 = currentEquippedItem as BulletWeaponItem <ShotgunDataBlock>;
                for (int i = 0; i < item4.datablock.numPellets; i++)
                {
                    stream.WriteByte(9);
                    stream.Write <NetEntityID>(NetEntityID.Get((UnityEngine.MonoBehaviour)targetCharacter), new object[0]);
                    stream.WriteVector3(targetCharacter.transform.position);
                }
                item4.itemRepresentation.ActionStream(1, uLink.RPCMode.Server, stream);
            }
            return(true);
        }