public static void Reload(NPCHumanContext c) { if (c == null) { return; } AttackEntity heldEntity = c.Human.GetHeldEntity() as AttackEntity; if (Object.op_Equality((Object)heldEntity, (Object)null)) { return; } BaseProjectile baseProjectile = heldEntity as BaseProjectile; if (!Object.op_Implicit((Object)baseProjectile) || !baseProjectile.primaryMagazine.CanAiReload((BasePlayer)c.Human)) { return; } baseProjectile.ServerReload(); if (c.Human.OnReload == null) { return; } c.Human.OnReload(); }
public virtual bool ShotTest() { AttackEntity heldEntity = base.GetHeldEntity() as AttackEntity; if (heldEntity == null) { return(false); } BaseProjectile baseProjectile = heldEntity as BaseProjectile; if (baseProjectile) { if (baseProjectile.primaryMagazine.contents <= 0) { baseProjectile.ServerReload(); NPCPlayerApex nPCPlayerApex = this as NPCPlayerApex; if (nPCPlayerApex && nPCPlayerApex.OnReload != null) { nPCPlayerApex.OnReload(); } return(false); } if (baseProjectile.NextAttackTime > Time.time) { return(false); } } if (Mathf.Approximately(heldEntity.attackLengthMin, -1f)) { heldEntity.ServerUse(this.damageScale); this.lastGunShotTime = Time.time; return(true); } NPCPlayer nPCPlayer = this; if (base.IsInvoking(new Action(nPCPlayer.TriggerDown))) { return(true); } if (Time.time < this.nextTriggerTime) { return(true); } NPCPlayer nPCPlayer1 = this; base.InvokeRepeating(new Action(nPCPlayer1.TriggerDown), 0f, 0.01f); this.triggerEndTime = Time.time + UnityEngine.Random.Range(heldEntity.attackLengthMin, heldEntity.attackLengthMax); this.TriggerDown(); return(true); }
public override void DoExecute(BaseContext c) { BasePlayer aIAgent = c.AIAgent as BasePlayer; if (aIAgent != null) { AttackEntity heldEntity = aIAgent.GetHeldEntity() as AttackEntity; if (heldEntity != null) { BaseProjectile baseProjectile = heldEntity as BaseProjectile; if (baseProjectile) { baseProjectile.ServerReload(); } } } }
public virtual bool ShotTest() { AttackEntity heldEntity = this.GetHeldEntity() as AttackEntity; if (Object.op_Equality((Object)heldEntity, (Object)null)) { return(false); } BaseProjectile baseProjectile = heldEntity as BaseProjectile; if (Object.op_Implicit((Object)baseProjectile)) { if (baseProjectile.primaryMagazine.contents <= 0) { baseProjectile.ServerReload(); NPCPlayerApex npcPlayerApex = this as NPCPlayerApex; if (Object.op_Implicit((Object)npcPlayerApex) && npcPlayerApex.OnReload != null) { npcPlayerApex.OnReload(); } return(false); } if ((double)baseProjectile.NextAttackTime > (double)Time.get_time()) { return(false); } } if (!Mathf.Approximately(heldEntity.attackLengthMin, -1f)) { if (this.IsInvoking(new Action(this.TriggerDown)) || (double)Time.get_time() < (double)this.nextTriggerTime) { return(true); } this.InvokeRepeating(new Action(this.TriggerDown), 0.0f, 0.01f); this.triggerEndTime = Time.get_time() + Random.Range(heldEntity.attackLengthMin, heldEntity.attackLengthMax); this.TriggerDown(); return(true); } heldEntity.ServerUse(this.damageScale); this.lastGunShotTime = Time.get_time(); return(true); }
public override void DoExecute(BaseContext c) { BasePlayer aiAgent = c.AIAgent as BasePlayer; if (!Object.op_Inequality((Object)aiAgent, (Object)null)) { return; } AttackEntity heldEntity = aiAgent.GetHeldEntity() as AttackEntity; if (!Object.op_Inequality((Object)heldEntity, (Object)null)) { return; } BaseProjectile baseProjectile = heldEntity as BaseProjectile; if (!Object.op_Implicit((Object)baseProjectile)) { return; } baseProjectile.ServerReload(); }
public static void Reload(NPCHumanContext c) { if (c == null) { return; } AttackEntity heldEntity = c.Human.GetHeldEntity() as AttackEntity; if (heldEntity == null) { return; } BaseProjectile baseProjectile = heldEntity as BaseProjectile; if (baseProjectile && baseProjectile.primaryMagazine.CanAiReload(c.Human)) { baseProjectile.ServerReload(); if (c.Human.OnReload != null) { c.Human.OnReload(); } } }