public void hitFromEnemy(int getDamage) { if (this.animator.GetCurrentAnimatorStateInfo(0).tagHash == this.enterCaveHash) { return; } if (this.currentAttacker) { EventRegistry.Enemy.Publish(TfEvent.EnemyContact, this.currentAttacker.GetComponentInParent<enemyType>().Type); } bool isHealthInGreyZone = this.IsHealthInGreyZone; if (!isHealthInGreyZone && (float)getDamage > this.Health) { getDamage = Mathf.Clamp(getDamage, 1, Mathf.FloorToInt(this.Health) - 1); } float num = 0f; if (this.currentAttacker) { Vector3 vector = base.transform.InverseTransformPoint(this.currentAttacker.transform.root.position); num = Mathf.Atan2(vector.x, vector.z) * 57.29578f; } bool flag = this.animator.GetBool("stickBlock") && num < 60f && num > -60f; if (flag) { if (this.blockDamagePercent > 0f) { try { if (this.CurrentArmorTypes[this.ArmorVis] == PlayerStats.ArmorTypes.None) { int damage = Mathf.FloorToInt((float)getDamage * (this.blockDamagePercent / 6f)); this.Hit(damage, true, PlayerStats.DamageType.Physical); } } catch { } } this.pm.SendEvent("blockReaction"); } else { if (this.animator.GetBool("stickBlock")) { getDamage /= 2; } this.Hit(getDamage, false, PlayerStats.DamageType.Physical); this.setSkinDamage(); this.pm.SendEvent("blockReaction"); } if (this.currentAttacker) { if (flag) { if (this.animator.GetBool("shellHeld")) { FMODCommon.PlayOneshotNetworked(this.currentAttacker.shellBlockEvent, base.transform, FMODCommon.NetworkRole.Server); } else { FMODCommon.PlayOneshotNetworked(this.currentAttacker.blockEvent, base.transform, FMODCommon.NetworkRole.Server); } } else { FMODCommon.PlayOneshotNetworked(this.currentAttacker.weaponHitEvent, base.transform, FMODCommon.NetworkRole.Server); } this.currentAttacker = null; } if (LocalPlayer.AnimControl.currRaft) { RaftGrab raftGrab = RaftGrab.Create(GlobalTargets.OnlyServer); raftGrab.Raft = LocalPlayer.AnimControl.currRaft.GetComponentInParent<BoltEntity>(); raftGrab.Player = null; raftGrab.Send(); } if (!isHealthInGreyZone && this.IsHealthInGreyZone && !this.Dead) { base.StartCoroutine(this.AdrenalineRush()); } }
public void setCurrentAttacker(enemyWeaponMelee attacker) { this.lastHitEnemyType = attacker.GetComponentInParent <enemyType>().Type; }
public void setCurrentAttacker(enemyWeaponMelee attacker) { this.currentAttacker = attacker; }