MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / Affect

Method Affect

ogsr_engine/xrGame/AmebaZone.cpp:32–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32void CAmebaZone::Affect(SZoneObjectInfo* O)
33{
34 CPhysicsShellHolder* pGameObject = smart_cast<CPhysicsShellHolder*>(O->object);
35 if (!pGameObject)
36 return;
37
38 if (O->zone_ignore)
39 return;
40
41#ifdef DEBUG
42 char l_pow[255];
43 sprintf_s(l_pow, "zone hit. %.1f", Power(distance_to_center(O->object)));
44 if (bDebug)
45 Msg("%s %s", *pGameObject->cName(), l_pow);
46#endif
47 Fvector hit_dir;
48 hit_dir.set(::Random.randF(-.5f, .5f), ::Random.randF(.0f, 1.f), ::Random.randF(-.5f, .5f));
49 hit_dir.normalize();
50
51 Fvector position_in_bone_space;
52
53 float power = Power(distance_to_center(O->object));
54 float impulse = m_fHitImpulseScale * power * pGameObject->GetMass();
55
56 //статистика по объекту
57 O->total_damage += power;
58 O->hit_num++;
59
60 if (power > 0.01f)
61 {
62 m_dwDeltaTime = 0;
63 position_in_bone_space.set(0.f, 0.f, 0.f);
64
65 CreateHit(pGameObject->ID(), ID(), hit_dir, power, 0, position_in_bone_space, impulse, m_eHitTypeBlowout);
66
67 PlayHitParticles(pGameObject);
68 }
69}
70
71void CAmebaZone::PhTune(dReal step)
72{

Callers

nothing calls this directly

Calls 8

PowerFunction · 0.85
MsgFunction · 0.85
IDFunction · 0.85
randFMethod · 0.80
cNameMethod · 0.45
setMethod · 0.45
normalizeMethod · 0.45
GetMassMethod · 0.45

Tested by

no test coverage detected