예제 #1
0
    public static void CreateIndicator(Vector3 worldPoint, bool followPoint, HUDHitIndicator prefab)
    {
        HUDHitIndicator indicator = (HUDHitIndicator)HUDIndicator.InstantiateIndicator(HUDIndicator.ScratchTarget.CenteredAuto, prefab, HUDIndicator.PlacementSpace.World, worldPoint);

        indicator.worldPosition = worldPoint;
        indicator.followPoint   = followPoint;
    }
예제 #2
0
 protected virtual void PlayHitNotification(Vector3 point, Character shooterOrNull)
 {
     if (WeaponDataBlock._hitNotify || Bundling.Load <AudioClip>("content/shared/sfx/hitnotification", out WeaponDataBlock._hitNotify))
     {
         WeaponDataBlock._hitNotify.PlayLocal(Camera.main.transform, Vector3.zero, 1f, 1);
     }
     if (WeaponDataBlock._hitIndicator || Bundling.Load <HUDHitIndicator>("content/hud/HUDHitIndicator", out WeaponDataBlock._hitIndicator))
     {
         HUDHitIndicator.CreateIndicator(point, (!shooterOrNull ? true : !shooterOrNull.stateFlags.aim), WeaponDataBlock._hitIndicator);
     }
 }
예제 #3
0
 protected virtual void PlayHitNotification(Vector3 point, Character shooterOrNull)
 {
     if ((WeaponDataBlock._hitNotify != null) || Bundling.Load <AudioClip>("content/shared/sfx/hitnotification", out WeaponDataBlock._hitNotify))
     {
         WeaponDataBlock._hitNotify.PlayLocal(Camera.main.transform, Vector3.zero, 1f, 1);
     }
     if ((_hitIndicator != null) || Bundling.Load <HUDHitIndicator>("content/hud/HUDHitIndicator", out _hitIndicator))
     {
         bool followPoint = true;
         HUDHitIndicator.CreateIndicator(point, followPoint, _hitIndicator);
     }
 }
예제 #4
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);
             }
         }
     }
 }
예제 #5
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);
             }
         }
     }
 }
예제 #6
0
 public static void CreateIndicator(Vector3 worldPoint, bool followPoint, HUDHitIndicator prefab)
 {
     HUDHitIndicator hUDHitIndicator = (HUDHitIndicator)HUDIndicator.InstantiateIndicator(HUDIndicator.ScratchTarget.CenteredAuto, prefab, HUDIndicator.PlacementSpace.World, worldPoint);
     hUDHitIndicator.worldPosition = worldPoint;
     hUDHitIndicator.followPoint = followPoint;
 }