1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
using UnityEngine;
public class StabMA : ManualAttack
{
public float maximumCooldownTime = 15f;
public float minimumCooldownPercentage = 0.2f;
private int targetsStabbed;
private AudioSet.ClipArray caSuccessfulHit;
private AudioSet.ClipArray caFailedHit;
public int TargetsStabeed => targetsStabbed;
public override void Start()
{
base.Start();
caSuccessfulHit = audioSet.PlayerBowStab;
caFailedHit = audioSet.PlayerBowStabMiss;
}
public override void Attack()
{
TaggedObject taggedObject = FindAttackTarget(_choosePreferredTargetIfPossible: true);
Hp hp = null;
if ((bool)taggedObject)
{
hp = taggedObject.Hp;
cooldownTime = maximumCooldownTime * (minimumCooldownPercentage + hp.HpPercentage * (1f - minimumCooldownPercentage));
cooldown = cooldownTime;
}
float num = 0f;
if ((bool)hp)
{
num = hp.HpValue;
}
weapon.Attack(base.transform.position + spawnAttackHeight * Vector3.up, hp, transformForAttackDirection.forward, myTaggedObj, base.AttackDamageMultiplyer);
if ((bool)hp)
{
if (num > hp.HpValue)
{
StabSuccessful();
}
else
{
StabMissed();
}
}
else if (num > 0f)
{
StabSuccessful();
}
else
{
StabMissed();
}
}
private void StabSuccessful()
{
audioManager.PlaySoundAsOneShot(caSuccessfulHit, 1f, Random.Range(0.9f, 1.1f), audioSet.mixGroupFX, 5);
targetsStabbed++;
}
private void StabMissed()
{
audioManager.PlaySoundAsOneShot(caFailedHit, 1f, Random.Range(0.9f, 1.1f), audioSet.mixGroupFX, 5);
}
}
|