コード例 #1
0
        void TriggerPart(SkillPart part)
        {
            _curPart = part;
#if DEBUG_SKILL
            _showTimer = Time.realtimeSinceStartup + 0.1f;
#endif


            var col = part.collider;
            if (col.radius > 0)
            {
                //circle
                CollisionManager.QueryRegion(targetLayer, owner.transform.TransformPoint(col.pos), col.radius,
                                             _OnTriggerEnter);
            }
            else
            {
                //aabb
                CollisionManager.QueryRegion(targetLayer, owner.transform.TransformPoint(col.pos), col.size,
                                             owner.transform.forward,
                                             _OnTriggerEnter);
            }

            foreach (var other in _tempTargets)
            {
                other.Entity.TakeDamage(_curPart.damage, other.Entity.transform.pos.ToLVector3());
            }

            //add force
            if (part.needForce)
            {
                var force   = part.impulseForce;
                var forward = owner.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 _tempTargets)
                {
                    other.Entity.rigidbody.AddImpulse(force);
                }
            }

            if (part.isResetForce)
            {
                foreach (var other in _tempTargets)
                {
                    other.Entity.rigidbody.ResetSpeed(new LFloat(3));
                }
            }

            _tempTargets.Clear();
        }
コード例 #2
0
 void CheckSkillPart(SkillPart part)
 {
     if (part.counter > part.otherCount)
     {
         return;
     }
     if (skillTimer > part.NextTriggerTimer())
     {
         TriggerPart(part);
         part.counter++;
     }
 }
コード例 #3
0
        private void ShowPartGizmons(SkillPart part)
        {
            var col = part.collider;

            if (col.radius > 0)
            {
                //circle
                var pos = owner?.transform.TransformPoint(col.pos) ?? col.pos;
                Gizmos.DrawSphere(pos.ToVector3XZ(LFloat.one), col.radius.ToFloat());
            }
            else
            {
                //aabb
                var pos = owner?.transform.TransformPoint(col.pos) ?? col.pos;
                Gizmos.DrawCube(pos.ToVector3XZ(LFloat.one), col.size.ToVector3XZ(LFloat.one));
                DebugExtension.DebugLocalCube(Matrix4x4.TRS(
                                                  pos.ToVector3XZ(LFloat.one),
                                                  Quaternion.Euler(0, owner.transform.deg.ToFloat(), 0),
                                                  Vector3.one),
                                              col.size.ToVector3XZ(LFloat.one), Gizmos.color);
            }
        }