Пример #1
0
 // Token: 0x06002BCE RID: 11214 RVA: 0x000A395C File Offset: 0x000A1B5C
 private void SetViewModel(global::ViewModel vm, global::ItemRepresentation rep, global::IHeldItem item)
 {
     if (!this.awoke)
     {
         this.viewModel = vm;
         this.rep       = rep;
         this.item      = item;
         return;
     }
     if (this.viewModel != vm)
     {
         bool flag = this.viewModel;
         if (flag)
         {
             if (this.viewModel.itemRep)
             {
                 try
                 {
                     this.viewModel.itemRep.UnBindViewModel(this.viewModel, this.viewModel.item);
                 }
                 catch (Exception ex)
                 {
                     Debug.LogException(ex, this.viewModel.itemRep);
                 }
             }
             this.viewModel.UnBindTransforms();
             this.viewModel.idMain = null;
         }
         this.viewModel = vm;
         if (vm)
         {
             if (!global::CameraFX.viewModelRootTransform)
             {
                 Transform transform = new GameObject("__View Model Root").transform;
                 global::CameraFX.viewModelRootTransform        = new GameObject("Eye Camera Difference").transform;
                 global::CameraFX.viewModelRootTransform.parent = transform;
             }
             vm.idMain           = this.idMain;
             vm.transform.parent = global::CameraFX.viewModelRootTransform;
             if (rep)
             {
                 rep.PrepareViewModel(vm, item);
             }
             vm.BindTransforms(global::CameraFX.viewModelRootTransform, base.transform.parent);
             if (rep)
             {
                 rep.BindViewModel(vm, item);
                 vm.itemRep = rep;
                 vm.item    = item;
             }
         }
         for (int i = this._effects.Length - 1; i >= 0; i--)
         {
             if (this._effects[i])
             {
                 this.effects[i].OnViewModelChange(vm);
             }
         }
     }
 }
    // Token: 0x060032BF RID: 12991 RVA: 0x000C01CC File Offset: 0x000BE3CC
    public void ArrowReportMiss(global::ArrowMovement arrow, global::ItemRepresentation itemRepresentation)
    {
        BitStream bitStream = new BitStream(false);

        bitStream.Write <Vector3>(arrow.transform.position, new object[0]);
        itemRepresentation.ActionStream(3, 0, bitStream);
    }
    // Token: 0x06003536 RID: 13622 RVA: 0x000C3AF8 File Offset: 0x000C1CF8
    public virtual void Local_SecondaryFire(global::ViewModel vm, global::ItemRepresentation itemRep, global::IMeleeWeaponItem itemInstance, ref global::HumanController.InputSample sample)
    {
        global::Character character = itemInstance.character;

        if (character == null)
        {
            return;
        }
        Ray        eyesRay = character.eyesRay;
        RaycastHit raycastHit;
        bool       flag = Physics.SphereCast(eyesRay, 0.3f, ref raycastHit, this.GetRange(), 406721553);

        if (flag)
        {
            IDBase component = raycastHit.collider.gameObject.GetComponent <IDBase>();
            if (component)
            {
                global::NetEntityID    netEntityID = global::NetEntityID.Get(component);
                global::RepairReceiver local       = component.GetLocal <global::RepairReceiver>();
                if (local != null && netEntityID != global::NetEntityID.unassigned)
                {
                    if (vm)
                    {
                        vm.PlayFireAnimation();
                    }
                    itemInstance.QueueSwingSound(Time.time + this.swingSoundDelay);
                    itemRep.Action <global::NetEntityID>(2, 0, netEntityID);
                }
            }
        }
    }
        // Token: 0x060038A0 RID: 14496 RVA: 0x000C9404 File Offset: 0x000C7604
        public void InstallMod(int slotNumber, global::ItemRepresentation owner, global::ItemModDataBlock datablock, global::CharacterStateFlags flags)
        {
            switch (slotNumber)
            {
            case 0:
                owner.InstallMod(ref this.a, 0, datablock, flags);
                break;

            case 1:
                owner.InstallMod(ref this.b, 1, datablock, flags);
                break;

            case 2:
                owner.InstallMod(ref this.c, 2, datablock, flags);
                break;

            case 3:
                owner.InstallMod(ref this.d, 3, datablock, flags);
                break;

            case 4:
                owner.InstallMod(ref this.e, 4, datablock, flags);
                break;

            default:
                throw new IndexOutOfRangeException();
            }
        }
    // Token: 0x060032C1 RID: 12993 RVA: 0x000C0298 File Offset: 0x000BE498
    public override void DoAction1(BitStream stream, global::ItemRepresentation rep, ref uLink.NetworkMessageInfo info)
    {
        Vector3    pos = stream.ReadVector3();
        Quaternion ang = stream.ReadQuaternion();

        this.FireArrow(pos, ang, rep, null);
    }
        // Token: 0x0600389C RID: 14492 RVA: 0x000C9244 File Offset: 0x000C7444
        public void UnBindAsProxy(int slotNumber, global::ItemRepresentation itemRep)
        {
            switch (slotNumber)
            {
            case 0:
                itemRep.UnBindModAsProxy(ref this.a);
                break;

            case 1:
                itemRep.UnBindModAsProxy(ref this.b);
                break;

            case 2:
                itemRep.UnBindModAsProxy(ref this.c);
                break;

            case 3:
                itemRep.UnBindModAsProxy(ref this.d);
                break;

            case 4:
                itemRep.UnBindModAsProxy(ref this.e);
                break;

            default:
                throw new IndexOutOfRangeException();
            }
        }
        // Token: 0x0600389D RID: 14493 RVA: 0x000C92D0 File Offset: 0x000C74D0
        public void ClearModPair(int slotNumber, global::ItemRepresentation owner)
        {
            switch (slotNumber)
            {
            case 0:
                owner.ClearModPair(ref this.a);
                break;

            case 1:
                owner.ClearModPair(ref this.b);
                break;

            case 2:
                owner.ClearModPair(ref this.c);
                break;

            case 3:
                owner.ClearModPair(ref this.d);
                break;

            case 4:
                owner.ClearModPair(ref this.e);
                break;

            default:
                throw new IndexOutOfRangeException();
            }
        }
Пример #8
0
    // Token: 0x06003231 RID: 12849 RVA: 0x000BF3FC File Offset: 0x000BD5FC
    public void Ignite(global::ViewModel vm, global::ItemRepresentation itemRep, global::IBasicTorchItem torchItem)
    {
        if (torchItem != null)
        {
            torchItem.Ignite();
        }
        bool flag = vm != null;

        if (flag)
        {
            GameObject light = vm.socketMap["muzzle"].socket.InstantiateAsChild(this.FirstPersonLightPrefab, false);
            if (torchItem != null)
            {
                torchItem.light = light;
            }
        }
        else if ((torchItem == null || !torchItem.light) && (!itemRep.networkView.isMine || global::actor.forceThirdPerson))
        {
            if (this.ThirdPersonLightPrefab)
            {
                ((global::BasicTorchItemRep)itemRep)._myLightPrefab = this.ThirdPersonLightPrefab;
            }
            ((global::BasicTorchItemRep)itemRep).RepIgnite();
            if (((global::BasicTorchItemRep)itemRep)._myLight && torchItem != null)
            {
                torchItem.light = ((global::BasicTorchItemRep)itemRep)._myLight;
            }
        }
    }
 // Token: 0x06003535 RID: 13621 RVA: 0x000C3ABC File Offset: 0x000C1CBC
 private void EndSwingWorldAnimations(global::ItemRepresentation itemRep)
 {
     if (!string.IsNullOrEmpty(this._swingingMovementAnimationGroupName) && this._swingingMovementAnimationGroupName != this.animationGroupName)
     {
         itemRep.OverrideAnimationGroupName(null);
     }
 }
    // Token: 0x060032BE RID: 12990 RVA: 0x000C0178 File Offset: 0x000BE378
    public void FireArrow(Vector3 pos, Quaternion ang, global::ItemRepresentation itemRep, global::IBowWeaponItem itemInstance)
    {
        GameObject            gameObject = (GameObject)Object.Instantiate(this.arrowPrefab, pos, ang);
        global::ArrowMovement component  = gameObject.GetComponent <global::ArrowMovement>();

        component.Init(this.arrowSpeed, itemRep, itemInstance, false);
        this.fireArrowSound.Play(pos, 1f, 2f, 10f);
    }
Пример #11
0
 // Token: 0x0600331F RID: 13087 RVA: 0x000C1048 File Offset: 0x000BF248
 public virtual AudioClip GetFarFireSound(global::ItemRepresentation itemRep)
 {
     if (this.IsSilenced(itemRep))
     {
         return(this.fireSound_SilencedFar);
     }
     return(this.fireSound_Far);
 }
Пример #12
0
    // Token: 0x06003447 RID: 13383 RVA: 0x000C2D38 File Offset: 0x000C0F38
    protected override GameObject ThrowItem(global::ItemRepresentation rep, global::IThrowableItem item, Vector3 origin, Vector3 forward, uLink.NetworkViewID owner)
    {
        forward.Normalize();
        Vector3 velocity = forward * 20f;
        Vector3 position = origin + forward * 0.5f;

        return(this.SpawnThrowItem(owner, this.throwObjectPrefab, position, Quaternion.LookRotation(Vector3.up), velocity));
    }
Пример #13
0
 // Token: 0x06003444 RID: 13380 RVA: 0x000C2BF4 File Offset: 0x000C0DF4
 public override void PrimaryAttack(global::ViewModel vm, global::ItemRepresentation itemRep, global::IThrowableItem itemInstance, ref global::HumanController.InputSample sample)
 {
     base.PrimaryAttack(vm, itemRep, itemInstance, ref sample);
     vm.Play("pull_pin");
     this.pullPinSound.Play();
     this.GetHandGrenadeItemInstance(itemInstance).nextPrimaryAttackTime   = Time.time + 1000f;
     this.GetHandGrenadeItemInstance(itemInstance).nextSecondaryAttackTime = Time.time + 1000f;
 }
Пример #14
0
    // Token: 0x060036B6 RID: 14006 RVA: 0x000C5AC0 File Offset: 0x000C3CC0
    protected virtual GameObject ThrowItem(global::ItemRepresentation rep, global::IThrowableItem item, Vector3 origin, Vector3 forward, uLink.NetworkViewID owner)
    {
        Vector3    velocity = forward * item.heldThrowStrength;
        Vector3    position = origin + forward * 1f;
        Quaternion rotation = Quaternion.LookRotation(Vector3.up);

        return(this.SpawnThrowItem(owner, this.throwObjectPrefab, position, rotation, velocity));
    }
Пример #15
0
 // Token: 0x0600331B RID: 13083 RVA: 0x000C0F9C File Offset: 0x000BF19C
 public virtual float GetBulletRange(global::ItemRepresentation itemRep)
 {
     if (!itemRep)
     {
         return(this.bulletRange);
     }
     return(this.bulletRange * ((!this.IsSilenced(itemRep)) ? 1f : 0.75f));
 }
 // Token: 0x06003534 RID: 13620 RVA: 0x000C3A6C File Offset: 0x000C1C6C
 private void StartSwingWorldAnimations(global::ItemRepresentation itemRep)
 {
     if (!string.IsNullOrEmpty(this._swingingMovementAnimationGroupName) && this._swingingMovementAnimationGroupName != this.animationGroupName)
     {
         itemRep.OverrideAnimationGroupName(this._swingingMovementAnimationGroupName);
     }
     itemRep.PlayWorldAnimation(0, this.worldSwingAnimationSpeed);
 }
 // Token: 0x06000265 RID: 613 RVA: 0x0000CBB4 File Offset: 0x0000ADB4
 public void Init(float arrowSpeed, global::ItemRepresentation itemRep, global::IBowWeaponItem itemInstance, bool firedLocal)
 {
     this.speedPerSec = arrowSpeed;
     if (itemRep != null && itemInstance != null)
     {
         this._myBow          = itemRep;
         this._myItemInstance = itemInstance;
     }
 }
Пример #18
0
    // Token: 0x0600363D RID: 13885 RVA: 0x000C54D0 File Offset: 0x000C36D0
    public virtual void Local_BeginStrikes(int numStrikes, global::ViewModel vm, global::ItemRepresentation itemRep, global::IStrikeGunItem itemInstance, ref global::HumanController.InputSample sample)
    {
        string name = "strike" + numStrikes;

        vm.Play(name, 4);
        AudioClip clip = this.strikeSounds[numStrikes - 1];

        clip.PlayLocal(Camera.main.transform, Vector3.zero, 1f, Random.Range(0.96f, 1.03f), 2f, 2f, 0);
    }
Пример #19
0
 // Token: 0x06003315 RID: 13077 RVA: 0x000C07B4 File Offset: 0x000BE9B4
 public virtual void Local_Reload(global::ViewModel vm, global::ItemRepresentation itemRep, global::IBulletWeaponItem itemInstance, ref global::HumanController.InputSample sample)
 {
     if (vm)
     {
         vm.PlayReloadAnimation();
     }
     this.reloadSound.PlayLocal(itemRep.transform, Vector3.zero, 1f, 0);
     itemRep.Action(3, 0);
 }
 // Token: 0x0600383E RID: 14398 RVA: 0x000C7A64 File Offset: 0x000C5C64
 internal void ClearItemRepresentation(global::ItemRepresentation value)
 {
     if (this.hasItem && this.itemRep == value)
     {
         this.itemRep = null;
         this.hasItem = false;
         this._animationGroupNameCached = null;
     }
 }
 // Token: 0x060032BC RID: 12988 RVA: 0x000C0088 File Offset: 0x000BE288
 public virtual void Local_ReadyArrow(global::ViewModel vm, global::ItemRepresentation itemRep, global::IBowWeaponItem itemInstance, ref global::HumanController.InputSample sample)
 {
     if (vm)
     {
         vm.Play("drawarrow", 0);
     }
     itemInstance.completeDrawTime = Time.time + this.drawLength;
     this.drawArrowSound.PlayLocal(Camera.main.transform, Vector3.zero, 1f, 1f, 3f, 20f, 0);
 }
 // Token: 0x060032C2 RID: 12994 RVA: 0x000C02C0 File Offset: 0x000BE4C0
 public virtual void Local_CancelArrow(global::ViewModel vm, global::ItemRepresentation itemRep, global::IBowWeaponItem itemInstance, ref global::HumanController.InputSample sample)
 {
     if (vm)
     {
         vm.CrossFade("cancelarrow", 0.15f);
     }
     this.MakeReadyIn(itemInstance, this.fireRate * 3f);
     this.cancelArrowSound.PlayLocal(Camera.main.transform, Vector3.zero, 1f, 1f, 3f, 20f, 0);
 }
 // Token: 0x060032C5 RID: 12997 RVA: 0x000C033C File Offset: 0x000BE53C
 public virtual void Local_GetTired(global::ViewModel vm, global::ItemRepresentation itemRep, global::IBowWeaponItem itemInstance, ref global::HumanController.InputSample sample)
 {
     if (itemInstance.tired)
     {
         return;
     }
     if (vm)
     {
         vm.CrossFade("tiredloop", 5f);
     }
 }
Пример #24
0
 // Token: 0x06003942 RID: 14658 RVA: 0x000CA940 File Offset: 0x000C8B40
 protected virtual void SetItemRepresentation(global::ItemRepresentation itemRep)
 {
     this._itemRep = itemRep;
     if (this._itemRep)
     {
         if (this._itemRep.datablock != this.datablock)
         {
             Debug.Log("yea the code below wasn't pointless..");
             this._itemRep.SetDataBlockFromHeldItem <T>(this);
         }
         this._itemRep.SetParent(base.inventory.gameObject);
     }
 }
    // Token: 0x0600353C RID: 13628 RVA: 0x000C4068 File Offset: 0x000C2268
    public override void DoAction2(BitStream stream, global::ItemRepresentation rep, ref uLink.NetworkMessageInfo info)
    {
        global::NetEntityID netEntityID = stream.Read <global::NetEntityID>(new object[0]);

        if (!netEntityID.isUnassigned)
        {
            IDBase idBase = netEntityID.idBase;
            if (!idBase)
            {
                return;
            }
        }
    }
Пример #26
0
    // Token: 0x06002BD0 RID: 11216 RVA: 0x000A3B30 File Offset: 0x000A1D30
    public static void ReplaceViewModel(global::ViewModel vm, global::ItemRepresentation rep, global::IHeldItem item, bool butDontDestroyOld)
    {
        global::CameraFX mainCameraFX = global::CameraFX.mainCameraFX;

        if (mainCameraFX && mainCameraFX.viewModel != vm)
        {
            global::ViewModel viewModel = mainCameraFX.viewModel;
            mainCameraFX.SetViewModel(vm, rep, item);
            if (!butDontDestroyOld && viewModel)
            {
                Object.Destroy(viewModel.gameObject);
            }
        }
    }
 // Token: 0x06003537 RID: 13623 RVA: 0x000C3BBC File Offset: 0x000C1DBC
 public virtual void Local_FireWeapon(global::ViewModel vm, global::ItemRepresentation itemRep, global::IMeleeWeaponItem itemInstance, ref global::HumanController.InputSample sample)
 {
     this.StartSwingWorldAnimations(itemRep);
     if (vm)
     {
         vm.PlayFireAnimation();
     }
     itemInstance.QueueSwingSound(Time.time + this.swingSoundDelay);
     itemInstance.QueueMidSwing(Time.time + this.midSwingDelay);
     if (itemRep.networkViewIsMine)
     {
         itemRep.Action(3, 0);
     }
 }
Пример #28
0
 // Token: 0x0600322D RID: 12845 RVA: 0x000BF384 File Offset: 0x000BD584
 public void DoActualExtinguish(global::ItemRepresentation itemRep, global::IBasicTorchItem itemInstance, global::ViewModel vm)
 {
     if (itemInstance == null)
     {
         Debug.Log("inst null");
     }
     if (itemRep == null)
     {
         Debug.Log("rep null");
     }
     if (vm == null)
     {
         Debug.Log("vm null ");
     }
     itemInstance.Extinguish();
 }
Пример #29
0
    // Token: 0x06003761 RID: 14177 RVA: 0x000C6454 File Offset: 0x000C4654
    public override void PrimaryAttack(global::ViewModel vm, global::ItemRepresentation itemRep, global::IThrowableItem itemInstance, ref global::HumanController.InputSample sample)
    {
        global::ITorchItem torchInstance = this.GetTorchInstance(itemInstance);

        if (torchInstance.isLit)
        {
            return;
        }
        if (vm)
        {
            vm.Play("ignite");
        }
        torchInstance.realIgniteTime          = Time.time + 0.8f;
        torchInstance.nextPrimaryAttackTime   = Time.time + 1.5f;
        torchInstance.nextSecondaryAttackTime = Time.time + 1.5f;
    }
Пример #30
0
 // Token: 0x06003852 RID: 14418 RVA: 0x000C7D58 File Offset: 0x000C5F58
 internal void Initialize(global::ItemRepresentation itemRep, int modSlot, global::CharacterStateFlags flags)
 {
     if (this._modSlot == -1)
     {
         if (!itemRep)
         {
             throw new ArgumentOutOfRangeException("itemRep", itemRep, "!itemRep");
         }
         if (modSlot < 0 || modSlot >= 5)
         {
             throw new ArgumentOutOfRangeException("modSlot", modSlot, "modSlot<0||modSlot>=MAX_SUPPORTED_ITEM_MODS");
         }
         this._itemRep = itemRep;
         this._modSlot = modSlot;
         if ((byte)(this.caps & global::ItemModRepresentation.Caps.Initialize) == 1)
         {
             try
             {
                 this.Initialize();
             }
             catch (Exception)
             {
                 this._itemRep = null;
                 this._modSlot = -1;
                 throw;
             }
         }
         this.HandleChangedStateFlags(flags, false);
     }
     else
     {
         if (this._modSlot == -2)
         {
             throw new InvalidOperationException("This ItemModRepresentation has been destroyed");
         }
         if (itemRep != this._itemRep || (modSlot < 0 && modSlot < 5 && modSlot != this._modSlot))
         {
             throw new InvalidOperationException(string.Format("The ItemModRepresentation was already initialized with {{\"item\":\"{0}\",\"slot\":{1}}} and cannot be re-initialized to use {{\"item\":\"{2|\",\"slot\":{3}}}", new object[]
             {
                 this._itemRep,
                 this._modSlot,
                 itemRep,
                 modSlot
             }));
         }
     }
 }