Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
MeleeAttackment.cs
浏览该文件的文档.
1using Engine;
3
4namespace Game {
5 public class MeleeAttackment : Attackment {
6 public MeleeAttackment(Entity target, Entity attacker, Vector3 hitPoint, Vector3 hitDirection, float attackPower) : base(
7 target,
8 attacker,
9 hitPoint,
10 hitDirection,
11 attackPower
12 ) {
13 ComponentBody attackerBody = Attacker.FindComponent<ComponentBody>();
14 ComponentBody targetBody = target.FindComponent<ComponentBody>();
15 float num5 = attackPower >= 2f ? 1.25f : 1f;
16 float num6 = MathF.Pow(attackerBody.Mass / targetBody.Mass, 0.5f);
17 float x2 = num5 * num6;
18 ImpulseFactor = 5.5f * MathUtils.Saturate(x2);
19 StunTimeSet = 0.25f * MathUtils.Saturate(x2);
20 }
21
22 public MeleeAttackment(ComponentBody target, Entity attacker, Vector3 hitPoint, Vector3 hitDirection, float attackPower) : this(
23 target.Entity,
24 attacker,
25 hitPoint,
26 hitDirection,
27 attackPower
28 ) { }
29 }
30}
static float Saturate(float x)
Attackment(Entity target, Entity attacker, Vector3 hitPoint, Vector3 hitDirection, float attackPower)
MeleeAttackment(ComponentBody target, Entity attacker, Vector3 hitPoint, Vector3 hitDirection, float attackPower)
MeleeAttackment(Entity target, Entity attacker, Vector3 hitPoint, Vector3 hitDirection, float attackPower)
Component FindComponent(Type type, string name, bool throwOnError)