Example #1
0
    public override void SecondaryAttack(ref HumanController.InputSample sample)
    {
        float single = Time.time + (T)this.datablock.fireRate;

        base.nextPrimaryAttackTime   = single;
        base.nextSecondaryAttackTime = single;
    }
Example #2
0
    public override void SecondaryAttack(ref HumanController.InputSample sample)
    {
        float num = Time.time + base.datablock.fireRate;

        base.nextPrimaryAttackTime   = num;
        base.nextSecondaryAttackTime = num;
    }
Example #3
0
    public override void SecondaryAttack(ref HumanController.InputSample sample)
    {
        base.nextSecondaryAttackTime = Time.time + (T)this.datablock.fireRateSecondary;
        T t = this.datablock;

        t.SecondaryAttack(base.viewModelInstance, base.itemRepresentation, this.iface as IThrowableItem, ref sample);
    }
Example #4
0
    public override void Reload(ref HumanController.InputSample sample)
    {
        T t = this.datablock;

        t.Local_Reload(base.viewModelInstance, base.itemRepresentation, this.iface as IBulletWeaponItem, ref sample);
        this.ActualReload();
        base.inventory.Refresh();
    }
Example #5
0
 public override void ItemPreFrame(ref HumanController.InputSample sample)
 {
     base.ItemPreFrame(ref sample);
     if ((this.holdingBack && !sample.attack) && ((Time.time - this.holdingStartTime) > this.minReleaseTime))
     {
         base.datablock.AttackReleased(base.viewModelInstance, base.itemRepresentation, base.iface as IThrowableItem, ref sample);
         this.holdingBack = false;
     }
 }
Example #6
0
    public void InvokeInputItemPostFrame(object item, ref HumanController.InputSample sample)
    {
        IHeldItem heldItem = item as IHeldItem;

        if (heldItem != null)
        {
            heldItem.ItemPostFrame(ref sample);
        }
    }
Example #7
0
 public virtual void ItemPreFrame(ref HumanController.InputSample sample)
 {
     if ((sample.attack2 && base.datablock.secondaryFireAims) && this.CanAim())
     {
         sample.attack2 = false;
         sample.aim     = true;
         sample.yaw    *= base.datablock.aimSensitivtyPercent;
         sample.pitch  *= base.datablock.aimSensitivtyPercent;
     }
 }
Example #8
0
 public override void PrimaryAttack(ref HumanController.InputSample sample)
 {
     if (!this.beganFiring)
     {
         int numStrikes = Mathf.Clamp(Random.Range(1, base.datablock.strikeDurations.Length + 1), 1, base.datablock.strikeDurations.Length);
         this.actualFireTime = Time.time + base.datablock.strikeDurations[numStrikes - 1];
         base.datablock.Local_BeginStrikes(numStrikes, base.viewModelInstance, base.itemRepresentation, base.iface as IStrikeGunItem, ref sample);
         this.beganFiring = true;
     }
 }
Example #9
0
    public object InvokeInputItemPreFrame(ref HumanController.InputSample sample)
    {
        IHeldItem heldItem = this.inputItem as IHeldItem;

        if (heldItem != null)
        {
            heldItem.ItemPreFrame(ref sample);
        }
        return(heldItem);
    }
Example #10
0
 public virtual void CancelAttack(ref HumanController.InputSample sample)
 {
     if (this.beganFiring)
     {
         ViewModel viewModelInstance = base.viewModelInstance;
         base.datablock.Local_CancelStrikes(base.viewModelInstance, base.itemRepresentation, base.iface as IStrikeGunItem, ref sample);
         base.nextPrimaryAttackTime = Time.time + 1f;
         this.ResetFiring();
     }
 }
Example #11
0
 public override void PrimaryAttack(ref HumanController.InputSample sample)
 {
     if (!this.beganFiring)
     {
         int num = UnityEngine.Random.Range(1, (int)(T)this.datablock.strikeDurations.Length + 1);
         num = Mathf.Clamp(num, 1, (int)(T)this.datablock.strikeDurations.Length);
         this.actualFireTime = Time.time + (T)this.datablock.strikeDurations[num - 1];
         T t = this.datablock;
         t.Local_BeginStrikes(num, base.viewModelInstance, base.itemRepresentation, this.iface as IStrikeGunItem, ref sample);
         this.beganFiring = true;
     }
 }
Example #12
0
 public override void ItemPreFrame(ref HumanController.InputSample sample)
 {
     base.ItemPreFrame(ref sample);
     if (this._aimHelper && (sample.attack && this.CanPlace()))
     {
         Character idMain = base.inventory.idMain as Character;
         if ((idMain == null) || idMain.stateFlags.grounded)
         {
             this.DoPlace();
         }
     }
 }
Example #13
0
 public override void ItemPreFrame(ref HumanController.InputSample sample)
 {
     base.ItemPreFrame(ref sample);
     if ((this.queuedSwingAttackTime > 0f) && (this.queuedSwingAttackTime < Time.time))
     {
         base.datablock.Local_MidSwing(base.viewModelInstance, base.itemRepresentation, base.iface as IMeleeWeaponItem, ref sample);
         this.queuedSwingAttackTime = -1f;
     }
     if ((this.queuedSwingSoundTime > 0f) && (this.queuedSwingSoundTime < Time.time))
     {
         base.datablock.SwingSound();
         this.queuedSwingSoundTime = -1f;
     }
 }
Example #14
0
    public override void PrimaryAttack(ref HumanController.InputSample sample)
    {
        float      fireRate = base.datablock.fireRate;
        Metabolism local    = base.inventory.GetLocal <Metabolism>();

        if ((local != null) && (local.GetCalorieLevel() <= 0f))
        {
            fireRate = base.datablock.fireRate * 2f;
        }
        float num2 = Time.time + fireRate;

        base.nextSecondaryAttackTime = num2;
        base.nextPrimaryAttackTime   = num2;
        base.datablock.Local_FireWeapon(base.viewModelInstance, base.itemRepresentation, base.iface as IMeleeWeaponItem, ref sample);
    }
Example #15
0
    public override void PrimaryAttack(ref HumanController.InputSample sample)
    {
        base.nextPrimaryAttackTime = Time.time + base.datablock.fireRate;
        if (base.datablock.NoAimingAfterShot)
        {
            this.nextAimTime = Time.time + base.datablock.fireRate;
        }
        ViewModel viewModelInstance = base.viewModelInstance;

        if (actor.forceThirdPerson)
        {
            viewModelInstance = null;
        }
        base.datablock.Local_FireWeapon(viewModelInstance, base.itemRepresentation, base.iface as IBulletWeaponItem, ref sample);
    }
Example #16
0
 public override void ItemPreFrame(ref HumanController.InputSample sample)
 {
     base.ItemPreFrame(ref sample);
     if (sample.attack && this.CanBandage())
     {
         this.Primary(ref sample);
     }
     else
     {
         if (this.lastFramePrimary)
         {
             this.CancelBandage();
         }
         this.lastFramePrimary = false;
     }
 }
Example #17
0
 public override void ItemPreFrame(ref HumanController.InputSample sample)
 {
     base.ItemPreFrame(ref sample);
     if (!this._aimHelper)
     {
         return;
     }
     if (sample.attack && this.CanPlace())
     {
         Character character = base.inventory.idMain as Character;
         if (character && !character.stateFlags.grounded)
         {
             return;
         }
         this.DoPlace();
     }
 }
Example #18
0
 public override void ItemPreFrame(ref HumanController.InputSample sample)
 {
     if ((sample.attack && (this.clipAmmo == 0)) && (base.nextPrimaryAttackTime <= Time.time))
     {
         base.datablock.Local_DryFire(base.viewModelInstance, base.itemRepresentation);
         base.nextPrimaryAttackTime = Time.time + 1f;
         sample.attack = false;
     }
     base.ItemPreFrame(ref sample);
     if (sample.aim && (base.datablock.aimSway > 0f))
     {
         float x    = Time.time * base.datablock.aimSwaySpeed;
         float num2 = base.datablock.aimSway * (!sample.crouch ? 1f : 0.6f);
         sample.yaw   += ((Mathf.PerlinNoise(x, x) - 0.5f) * num2) * Time.deltaTime;
         sample.pitch += ((Mathf.PerlinNoise(x + 0.1f, x + 0.2f) - 0.5f) * num2) * Time.deltaTime;
     }
 }
Example #19
0
    public override void PrimaryAttack(ref HumanController.InputSample sample)
    {
        float      single = (T)this.datablock.fireRate;
        Metabolism local  = base.inventory.GetLocal <Metabolism>();

        if (local && local.GetCalorieLevel() <= 0f)
        {
            single = (T)this.datablock.fireRate * 2f;
        }
        float single1 = Time.time + single;

        base.nextSecondaryAttackTime = single1;
        base.nextPrimaryAttackTime   = single1;
        T t = this.datablock;

        t.Local_FireWeapon(base.viewModelInstance, base.itemRepresentation, this.iface as IMeleeWeaponItem, ref sample);
    }
Example #20
0
 public override void ItemPreFrame(ref HumanController.InputSample sample)
 {
     if (sample.attack && this.clipAmmo == 0 && base.nextPrimaryAttackTime <= Time.time)
     {
         this.datablock.Local_DryFire(base.viewModelInstance, base.itemRepresentation);
         base.nextPrimaryAttackTime = Time.time + 1f;
         sample.attack = false;
     }
     base.ItemPreFrame(ref sample);
     if (sample.aim && (T)this.datablock.aimSway > 0f)
     {
         float single  = Time.time * (T)this.datablock.aimSwaySpeed;
         float single1 = (T)this.datablock.aimSway * (!sample.crouch ? 1f : 0.6f);
         sample.yaw   = sample.yaw + (Mathf.PerlinNoise(single, single) - 0.5f) * single1 * Time.deltaTime;
         sample.pitch = sample.pitch + (Mathf.PerlinNoise(single + 0.1f, single + 0.2f) - 0.5f) * single1 * Time.deltaTime;
     }
 }
Example #21
0
 public override void ItemPreFrame(ref HumanController.InputSample sample)
 {
     base.ItemPreFrame(ref sample);
     if (!sample.attack && this.beganFiring)
     {
         this.CancelAttack(ref sample);
         sample.attack = false;
     }
     if (sample.attack && base.clipAmmo == 0 && this.canReload)
     {
         this.Reload(ref sample);
     }
     if (this.beganFiring && sample.attack && Time.time > this.actualFireTime)
     {
         base.PrimaryAttack(ref sample);
         this.ResetFiring();
     }
 }
Example #22
0
 public override void ItemPreFrame(ref HumanController.InputSample sample)
 {
     base.ItemPreFrame(ref sample);
     if ((this.realThrowTime != 0f) && (Time.time >= this.realThrowTime))
     {
         base.datablock.DoActualThrow(base.itemRepresentation, base.iface as ITorchItem, base.viewModelInstance);
         this.realThrowTime = 0f;
     }
     if ((this.realIgniteTime != 0f) && (Time.time >= this.realIgniteTime))
     {
         base.datablock.DoActualIgnite(base.itemRepresentation, base.iface as ITorchItem, base.viewModelInstance);
         this.realIgniteTime = 0f;
     }
     if ((this.forceSecondaryTime != 0f) && (Time.time >= this.forceSecondaryTime))
     {
         this.SecondaryAttack(ref sample);
         this.forceSecondaryTime = 0f;
     }
 }
Example #23
0
 public override void ItemPreFrame(ref HumanController.InputSample sample)
 {
     base.ItemPreFrame(ref sample);
     if (sample.is_sprinting)
     {
         float single = Time.time + 0.1f;
         this.nextPrimaryAttackTime = (this.nextPrimaryAttackTime <= single ? single : this.nextPrimaryAttackTime);
         this.wasSprinting          = true;
     }
     else if (this.wasSprinting)
     {
         float single1 = Time.time + 0.3f;
         this.nextPrimaryAttackTime = (this.nextPrimaryAttackTime <= single1 ? single1 : this.nextPrimaryAttackTime);
         this.wasSprinting          = false;
     }
     if ((T)this.datablock.isSemiAuto)
     {
         if (sample.attack && this.lastFrameAttack)
         {
             sample.attack = false;
         }
         else if (!sample.attack && this.lastFrameAttack)
         {
             this.lastFrameAttack = false;
         }
         else if (sample.attack && !this.lastFrameAttack)
         {
             this.lastFrameAttack = true;
         }
     }
     if (sample.attack && this.canPrimaryAttack)
     {
         this.PrimaryAttack(ref sample);
     }
     if (sample.attack2 && this.canSecondaryAttack)
     {
         this.SecondaryAttack(ref sample);
     }
     if (sample.reload && this.canReload)
     {
         this.Reload(ref sample);
     }
 }
Example #24
0
 public override void ItemPreFrame(ref HumanController.InputSample sample)
 {
     base.ItemPreFrame(ref sample);
     try
     {
         if (sample.attack2 && !this.lastFrameAttack2)
         {
             this.desiredRotation *= Quaternion.AngleAxis(90f, Vector3.up);
         }
         if (sample.attack && this.CanPlace())
         {
             this.DoPlace();
         }
         this.lastFrameAttack2 = sample.attack2;
     }
     catch (Exception exception)
     {
         this.InformException(exception, "in ItemPreFrame", ref StructureComponentItem <T> .informedPreFrame, null);
     }
 }
Example #25
0
    public virtual void Primary(ref HumanController.InputSample sample)
    {
        this.lastFramePrimary = true;
        sample.crouch         = true;
        sample.walk           = 0f;
        sample.strafe         = 0f;
        sample.jump           = false;
        sample.sprint         = false;
        if (this.bandageStartTime == -1f)
        {
            this.StartBandage();
        }
        float  single  = Time.time - this.bandageStartTime;
        float  single1 = Mathf.Clamp(single / (T)this.datablock.bandageDuration, 0f, 1f);
        string empty   = string.Empty;
        bool   flag    = this.datablock.DoesGiveBlood();
        bool   flag1   = this.datablock.DoesBandage();

        if (flag1 && !flag)
        {
            empty = "Bandaging...";
        }
        else if (flag1 && flag)
        {
            empty = "Bandage + Transfusion...";
        }
        else if (!flag1 && flag)
        {
            empty = "Transfusing...";
        }
        RPOS.SetActionProgress(true, empty, single1);
        if (single1 >= 1f)
        {
            this.FinishBandage();
        }
    }
Example #26
0
    public virtual void Primary(ref HumanController.InputSample sample)
    {
        this.lastFramePrimary = true;
        sample.crouch         = true;
        sample.walk           = 0f;
        sample.strafe         = 0f;
        sample.jump           = false;
        sample.sprint         = false;
        if (this.bandageStartTime == -1f)
        {
            this.StartBandage();
        }
        float  num      = Time.time - this.bandageStartTime;
        float  progress = Mathf.Clamp((float)(num / base.datablock.bandageDuration), (float)0f, (float)1f);
        string label    = string.Empty;
        bool   flag     = base.datablock.DoesGiveBlood();
        bool   flag2    = base.datablock.DoesBandage();

        if (flag2 && !flag)
        {
            label = "Bandaging...";
        }
        else if (flag2 && flag)
        {
            label = "Bandage + Transfusion...";
        }
        else if (!flag2 && flag)
        {
            label = "Transfusing...";
        }
        RPOS.SetActionProgress(true, label, progress);
        if (progress >= 1f)
        {
            this.FinishBandage();
        }
    }
Example #27
0
 public override void PrimaryAttack(ref HumanController.InputSample sample)
 {
     base.nextPrimaryAttackTime = Time.time + base.datablock.fireRate;
     base.datablock.PrimaryAttack(base.viewModelInstance, base.itemRepresentation, base.iface as IThrowableItem, ref sample);
 }
Example #28
0
 public virtual void Local_CancelArrow(ViewModel vm, ItemRepresentation itemRep, IBowWeaponItem itemInstance, ref HumanController.InputSample sample)
 {
     if (vm != null)
     {
         vm.CrossFade("cancelarrow", 0.15f);
     }
     this.MakeReadyIn(itemInstance, base.fireRate * 3f);
     this.cancelArrowSound.PlayLocal(Camera.main.transform, Vector3.zero, 1f, 1f, 3f, 20f, 0);
 }
Example #29
0
 public virtual void Local_ReadyArrow(ViewModel vm, ItemRepresentation itemRep, IBowWeaponItem itemInstance, ref HumanController.InputSample sample)
 {
     if (vm != null)
     {
         vm.Play("drawarrow", PlayMode.StopSameLayer);
     }
     itemInstance.completeDrawTime = Time.time + this.drawLength;
     this.drawArrowSound.PlayLocal(Camera.main.transform, Vector3.zero, 1f, 1f, 3f, 20f, 0);
 }
Example #30
0
 public virtual void Local_GetTired(ViewModel vm, ItemRepresentation itemRep, IBowWeaponItem itemInstance, ref HumanController.InputSample sample)
 {
     if (!itemInstance.tired && (vm != null))
     {
         vm.CrossFade("tiredloop", 5f);
     }
 }
Example #31
0
 public static HumanController.InputSample Poll(bool noLamp, bool noLaser)
 {
     HumanController.InputSample inputSample = new HumanController.InputSample();
     if (ConsoleWindow.IsVisible())
     {
         return new HumanController.InputSample();
     }
     if (MainMenu.IsVisible())
     {
         return new HumanController.InputSample();
     }
     if (ChatUI.IsVisible())
     {
         return new HumanController.InputSample();
     }
     if (LockEntry.IsVisible())
     {
         return new HumanController.InputSample();
     }
     if (LockCursorManager.IsLocked(true))
     {
         float single = Time.deltaTime;
         inputSample.info__crouchBlocked = false;
         inputSample.walk = 0f;
         if (GameInput.GetButton("Up").IsDown())
         {
             inputSample.walk = inputSample.walk + 1f;
         }
         if (GameInput.GetButton("Down").IsDown())
         {
             inputSample.walk = inputSample.walk - 1f;
         }
         inputSample.strafe = 0f;
         if (GameInput.GetButton("Right").IsDown())
         {
             inputSample.strafe = inputSample.strafe + 1f;
         }
         if (GameInput.GetButton("Left").IsDown())
         {
             inputSample.strafe = inputSample.strafe - 1f;
         }
         inputSample.yaw = GameInput.mouseDeltaX + HumanController.InputSample.yawSensitivityJoy * Input.GetAxis("Yaw") * single;
         inputSample.pitch = GameInput.mouseDeltaY + HumanController.InputSample.pitchSensitivityJoy * Input.GetAxis("Pitch") * single;
         if (input.flipy)
         {
             inputSample.pitch = inputSample.pitch * -1f;
         }
         inputSample.jump = GameInput.GetButton("Jump").IsDown();
         inputSample.crouch = GameInput.GetButton("Duck").IsDown();
         inputSample.sprint = GameInput.GetButton("Sprint").IsDown();
         inputSample.aim = false;
         inputSample.attack = GameInput.GetButton("Fire").IsDown();
         inputSample.attack2 = GameInput.GetButton("AltFire").IsDown();
         inputSample.reload = GameInput.GetButton("Reload").IsDown();
         inputSample.inventory = GameInput.GetButton("Inventory").IsPressed();
         inputSample.lamp = (!noLamp ? HumanController.InputSample.saved.GetLamp(GameInput.GetButton("Flashlight").IsPressed()) : HumanController.InputSample.saved.lamp);
         inputSample.laser = (!noLaser ? HumanController.InputSample.saved.GetLaser(GameInput.GetButton("Laser").IsPressed()) : HumanController.InputSample.saved.laser);
     }
     else
     {
         inputSample = new HumanController.InputSample();
         if (!UIUnityEvents.shouldBlockButtonInput)
         {
             inputSample.inventory = GameInput.GetButton("Inventory").IsPressed();
         }
         inputSample.lamp = HumanController.InputSample.saved.lamp;
         inputSample.laser = HumanController.InputSample.saved.laser;
     }
     if (GameInput.GetButton("Chat").IsPressed())
     {
         ChatUI.Open();
     }
     return inputSample;
 }