2021-12-05 17:54:36 +00:00
|
|
|
#include "AgLaserSensorServer.h"
|
|
|
|
|
2022-07-05 06:00:10 +00:00
|
|
|
#include "PhantomPhysicsComponent.h"
|
|
|
|
#include "SkillComponent.h"
|
|
|
|
#include "EntityManager.h"
|
|
|
|
#include "AgMonumentLaserServer.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
#include "EntityManager.h"
|
2023-03-25 10:26:39 +00:00
|
|
|
#include "ePhysicsEffectType.h"
|
2023-03-04 07:16:37 +00:00
|
|
|
#include "eReplicaComponentType.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void AgLaserSensorServer::OnStartup(Entity* self) {
|
|
|
|
|
2023-03-04 07:16:37 +00:00
|
|
|
PhantomPhysicsComponent* physComp = static_cast<PhantomPhysicsComponent*>(self->GetComponent(eReplicaComponentType::PHANTOM_PHYSICS));
|
2021-12-05 17:54:36 +00:00
|
|
|
physComp->SetPhysicsEffectActive(true);
|
2023-03-25 10:26:39 +00:00
|
|
|
physComp->SetEffectType(ePhysicsEffectType::REPULSE);
|
2021-12-05 17:54:36 +00:00
|
|
|
physComp->SetDirectionalMultiplier(static_cast<float>(m_RepelForce));
|
|
|
|
physComp->SetDirection(NiPoint3::UNIT_Y);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
m_Skill = self->GetComponent<SkillComponent>();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AgLaserSensorServer::OnCollisionPhantom(Entity* self, Entity* target) {
|
|
|
|
|
|
|
|
if (!m_Skill) return;
|
|
|
|
|
|
|
|
|
|
|
|
Entity* laser = nullptr;
|
|
|
|
|
2023-03-04 07:16:37 +00:00
|
|
|
for (auto script : EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPT)) {
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
AgMonumentLaserServer* hasLaser = (AgMonumentLaserServer*)script;
|
|
|
|
|
|
|
|
if (hasLaser) {
|
|
|
|
const auto source = script->GetPosition();
|
|
|
|
const auto obj = self->GetObjectID();
|
|
|
|
|
|
|
|
if (obj == 76690936093053 && Vector3::DistanceSquared(source, NiPoint3(149.007f, 417.083f, 218.346f)) <= 1.0f) {
|
|
|
|
laser = script;
|
|
|
|
break;
|
|
|
|
} else if (obj == 75866302318824 && Vector3::DistanceSquared(source, NiPoint3(48.6403f, 403.803f, 196.711f)) <= 1.0f) {
|
|
|
|
laser = script;
|
|
|
|
break;
|
|
|
|
} else if (obj == 75866302318822 && Vector3::DistanceSquared(source, NiPoint3(19.2155f, 420.083f, 249.226f)) <= 1.0f) {
|
|
|
|
laser = script;
|
|
|
|
break;
|
|
|
|
} else if (obj == 75866302318823 && Vector3::DistanceSquared(source, NiPoint3(-6.61596f, 404.633f, 274.323f)) <= 1.0f) {
|
|
|
|
laser = script;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (laser != nullptr) {
|
|
|
|
m_Skill->CalculateBehavior(m_SkillCastID, 15714, target->GetObjectID());
|
|
|
|
}
|
|
|
|
}
|