public override void DoAwake(IServiceContainer services) { _instance = this; config = _gameConfigService.CollisionConfig; DoStart(); }
void TriggerPart(SkillPart part, int idx) { eventHandler.OnSkillPartStart(this); _curPartIdx = idx; #if DEBUG_SKILL _showTimer = Time.realtimeSinceStartup + 0.1f; #endif var col = part.collider; #if NO_DEBUG_NO_COLLISION if (col.radius > 0) { //circle PhysicSystem.QueryRegion(TargetLayer, entity.transform.TransformPoint(col.pos), col.radius, _OnTriggerEnter); } else { //aabb PhysicSystem.QueryRegion(TargetLayer, entity.transform.TransformPoint(col.pos), col.size, entity.transform.forward, _OnTriggerEnter); } #else //TODO Ignore CollisionSystem if (col.radius > 0) { var colPos = entity.transform.TransformPoint(col.pos); foreach (var e in entity.GameStateService.GetEnemies()) { var targetCenter = e.transform.pos; if ((targetCenter - colPos).sqrMagnitude < col.radius * col.radius) { _tempEntities.Add(e); } } } #endif foreach (var other in _tempEntities) { other.TakeDamage(entity, CurPart.damage, other.transform.pos.ToLVector3()); } //add force if (part.needForce) { var force = part.impulseForce; var forward = entity.transform.forward; var right = forward.RightVec(); var z = forward * force.z + right * force.x; force.x = z.x; force.z = z.y; foreach (var other in _tempEntities) { other.rigidbody.AddImpulse(force); } } if (part.isResetForce) { foreach (var other in _tempEntities) { other.rigidbody.ResetSpeed(new LFloat(3)); } } _tempEntities.Clear(); }