예제 #1
0
    public virtual void Local_SecondaryFire(ViewModel vm, ItemRepresentation itemRep, IMeleeWeaponItem itemInstance, ref HumanController.InputSample sample)
    {
        RaycastHit raycastHit;
        Character  character = itemInstance.character;

        if (character == null)
        {
            return;
        }
        if (Physics.SphereCast(character.eyesRay, 0.3f, out raycastHit, this.GetRange(), 406721553))
        {
            IDBase component = raycastHit.collider.gameObject.GetComponent <IDBase>();
            if (component)
            {
                NetEntityID netEntityID = NetEntityID.Get(component);
                if (component.GetLocal <RepairReceiver>() != null && netEntityID != NetEntityID.unassigned)
                {
                    if (vm)
                    {
                        vm.PlayFireAnimation();
                    }
                    itemInstance.QueueSwingSound(Time.time + this.swingSoundDelay);
                    itemRep.Action <NetEntityID>(2, uLink.RPCMode.Server, netEntityID);
                }
            }
        }
    }
예제 #2
0
 public virtual void Local_Reload(ViewModel vm, ItemRepresentation itemRep, IBulletWeaponItem itemInstance, ref HumanController.InputSample sample)
 {
     if (vm)
     {
         vm.PlayReloadAnimation();
     }
     this.reloadSound.PlayLocal(itemRep.transform, Vector3.zero, 1f, 0);
     itemRep.Action(3, uLink.RPCMode.Server);
 }
예제 #3
0
 public virtual void Local_FireWeapon(ViewModel vm, ItemRepresentation itemRep, IMeleeWeaponItem itemInstance, ref HumanController.InputSample sample)
 {
     this.StartSwingWorldAnimations(itemRep);
     if (vm != null)
     {
         vm.PlayFireAnimation();
     }
     itemInstance.QueueSwingSound(Time.time + this.swingSoundDelay);
     itemInstance.QueueMidSwing(Time.time + this.midSwingDelay);
     if (itemRep.networkViewIsMine)
     {
         itemRep.Action(3, RPCMode.Server);
     }
 }
예제 #4
0
    public virtual void DoPlace()
    {
        this._nextPlaceTime = Time.time + 0.5f;
        Character character = base.character;

        if (character == null)
        {
            Debug.Log("NO char for placement");
            return;
        }
        Ray ray = character.eyesRay;
        ItemRepresentation itemRepresentation = base.itemRepresentation;

        object[] objArray = new object[] { ray.origin, ray.direction, this._placePos, this._placeRot, null };
        objArray[4] = (this._master == null ? uLink.NetworkViewID.unassigned : this._master.networkView.viewID);
        itemRepresentation.Action(1, uLink.RPCMode.Server, objArray);
    }
예제 #5
0
 public void AutoWood()
 {
     if (CVars.Misc.AutoWood)
     {
         WoodBlockerTemp.numWood = -1f;
         Character component = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>();
         Inventory inventory = component.GetComponent(typeof(Inventory)) as Inventory;
         MeleeWeaponItem <MeleeWeaponDataBlock> meleeWeaponItem = inventory._activeItem as MeleeWeaponItem <MeleeWeaponDataBlock>;
         if (inventory._activeItem is MeleeWeaponItem <MeleeWeaponDataBlock> && Time.time - this.LAST_ATTACK_TIME > meleeWeaponItem.datablock.fireRate && this.AUTO_WOOD_GATHER)
         {
             this.LAST_ATTACK_TIME = Time.time;
             ItemRepresentation itemRepresentation = meleeWeaponItem.itemRepresentation;
             IMeleeWeaponItem   meleeWeaponItem2   = meleeWeaponItem.iface as IMeleeWeaponItem;
             RaycastHit2        raycastHit;
             bool    flag  = Physics2.Raycast2(component.eyesRay, out raycastHit, meleeWeaponItem.datablock.range, 406721553);
             Vector3 point = raycastHit.point;
             itemRepresentation.Action(3, uLink.RPCMode.Server);
             uLink.BitStream bitStream = new uLink.BitStream(false);
             if (flag)
             {
                 IDMain idMain = raycastHit.idMain;
                 bitStream.WriteBoolean(true);
                 bitStream.Write <NetEntityID>(NetEntityID.Get(idMain), new object[0]);
                 bitStream.WriteVector3(point);
                 bitStream.WriteBoolean(false);
                 itemRepresentation.ActionStream(1, uLink.RPCMode.Server, bitStream);
                 HUDHitIndicator hUDHitIndicator;
                 if (Facepunch.Bundling.Load <HUDHitIndicator>("content/hud/HUDHitIndicator", out hUDHitIndicator))
                 {
                     HUDHitIndicator.CreateIndicator(point, true, hUDHitIndicator);
                 }
             }
             else
             {
                 bitStream.WriteBoolean(false);
                 bitStream.WriteVector3(Vector3.zero);
                 bitStream.WriteBoolean(true);
                 itemRepresentation.ActionStream(1, uLink.RPCMode.Server, bitStream);
             }
         }
     }
 }
예제 #6
0
 public void AutoWood()
 {
     if (CVars.Misc.AutoWood)
     {
         Character component = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>();
         Inventory inventory = component.GetComponent(typeof(Inventory)) as Inventory;
         MeleeWeaponItem <MeleeWeaponDataBlock> item = inventory._activeItem as MeleeWeaponItem <MeleeWeaponDataBlock>;
         if (((inventory._activeItem is MeleeWeaponItem <MeleeWeaponDataBlock>) && ((Time.time - this.LAST_ATTACK_TIME) > item.datablock.fireRate)) && this.AUTO_WOOD_GATHER)
         {
             RaycastHit2 hit;
             this.LAST_ATTACK_TIME = Time.time;
             ItemRepresentation itemRepresentation = item.itemRepresentation;
             IMeleeWeaponItem   iface = item.iface as IMeleeWeaponItem;
             bool    flag             = Physics2.Raycast2(component.eyesRay, out hit, item.datablock.range, 0x183e1411);
             Vector3 point            = hit.point;
             itemRepresentation.Action(3, uLink.RPCMode.Server);
             uLink.BitStream stream = new uLink.BitStream(false);
             if (flag)
             {
                 HUDHitIndicator indicator;
                 IDMain          idMain = hit.idMain;
                 stream.WriteBoolean(true);
                 stream.Write <NetEntityID>(NetEntityID.Get((UnityEngine.MonoBehaviour)idMain), new object[0]);
                 stream.WriteVector3(point);
                 stream.WriteBoolean(false);
                 itemRepresentation.ActionStream(1, uLink.RPCMode.Server, stream);
                 if (Bundling.Load <HUDHitIndicator>("content/hud/HUDHitIndicator", out indicator))
                 {
                     HUDHitIndicator.CreateIndicator(point, true, indicator);
                 }
             }
             else
             {
                 stream.WriteBoolean(false);
                 stream.WriteVector3(Vector3.zero);
                 stream.WriteBoolean(true);
                 itemRepresentation.ActionStream(1, uLink.RPCMode.Server, stream);
             }
         }
     }
 }
예제 #7
0
    public virtual void DoActualThrow(ItemRepresentation itemRep, IThrowableItem itemInstance, ViewModel vm)
    {
        Character component  = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>();
        Vector3   eyesOrigin = component.eyesOrigin;
        Vector3   forward    = component.eyesAngles.forward;

        if (vm != null)
        {
            vm.PlayQueued("deploy");
        }
        int count = 1;

        if (itemInstance.Consume(ref count))
        {
            itemInstance.inventory.RemoveItem(itemInstance.slot);
        }
        uLink.BitStream argument = new uLink.BitStream(false);
        argument.WriteVector3(eyesOrigin);
        argument.WriteVector3(forward);
        itemRep.Action <uLink.BitStream>(1, uLink.RPCMode.Server, argument);
    }
예제 #8
0
    public virtual void DoActualThrow(ItemRepresentation itemRep, IThrowableItem itemInstance, ViewModel vm)
    {
        Character component = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>();
        Vector3   vector3   = component.eyesOrigin;
        Vector3   vector31  = component.eyesAngles.forward;

        if (vm)
        {
            vm.PlayQueued("deploy");
        }
        int num = 1;

        if (itemInstance.Consume(ref num))
        {
            itemInstance.inventory.RemoveItem(itemInstance.slot);
        }
        uLink.BitStream bitStream = new uLink.BitStream(false);
        bitStream.WriteVector3(vector3);
        bitStream.WriteVector3(vector31);
        itemRep.Action <uLink.BitStream>(1, uLink.RPCMode.Server, bitStream);
    }
예제 #9
0
    public virtual void Local_SecondaryFire(ViewModel vm, ItemRepresentation itemRep, IMeleeWeaponItem itemInstance, ref HumanController.InputSample sample)
    {
        RaycastHit hit;
        Character  character = itemInstance.character;

        if ((character != null) && Physics.SphereCast(character.eyesRay, 0.3f, out hit, this.GetRange(), 0x183e1411))
        {
            IDBase component = hit.collider.gameObject.GetComponent <IDBase>();
            if (component != null)
            {
                NetEntityID argument = NetEntityID.Get((MonoBehaviour)component);
                if ((component.GetLocal <RepairReceiver>() != null) && (argument != NetEntityID.unassigned))
                {
                    if (vm != null)
                    {
                        vm.PlayFireAnimation();
                    }
                    itemInstance.QueueSwingSound(Time.time + this.swingSoundDelay);
                    itemRep.Action <NetEntityID>(2, RPCMode.Server, argument);
                }
            }
        }
    }
예제 #10
0
 public void DoActualIgnite(ItemRepresentation itemRep, IBasicTorchItem itemInstance, ViewModel vm)
 {
     this.Ignite(vm, itemRep, itemInstance);
     itemRep.Action(2, RPCMode.Server);
 }
예제 #11
0
 public void DoActualIgnite(ItemRepresentation itemRep, IThrowableItem itemInstance, ViewModel vm)
 {
     this.Ignite(vm, itemRep, this.GetTorchInstance(itemInstance));
     itemRep.Action(2, uLink.RPCMode.Server);
 }