Beispiel #1
0
 internal void OnCollisionEnd(SCollisionResult res)
 {
     if (isAlive)
     {
         foreach (var i in _componentList)
         {
             i.Value.OnCollisionEnd(res);
         }
     }
 }
Beispiel #2
0
 protected override bool GenerateCollisionRes(SICollider other, out SCollisionResult selfres, out SCollisionResult otherres)
 {
     if (other.GetType().Equals(typeof(SSphereCollider)))
     {
         var minDis = (other.position - position).sqrtMagnitude;
         if (minDis <= (radius + other.radius) * (radius + other.radius))
         {
             //SDebug.LogWarning(gameObject.name + " BAAAAAANG!!!  " + minDis);
         }
     }
     else if (other.GetType().Equals(typeof(SCapsuleCollider)))
     {
         var   oth    = other as SCapsuleCollider;
         Fix64 minDis = Fix64.MaxValue;
         var   atop   = position - oth.positionA;
         var   btop   = position - oth.positionB;
         var   ti     = atop.Dot(oth.up);
         var   tj     = btop.Dot(oth.up);
         var   w      = position - oth.positionA;
         if (ti * tj < Fix64.Zero)
         {
             minDis = w.sqrtMagnitude - w.Dot(oth.up) * w.Dot(up);
         }
         else if (ti <= Fix64.Zero)
         {
             minDis = atop.sqrtMagnitude;
         }
         else if (tj >= Fix64.Zero)
         {
             minDis = btop.sqrtMagnitude;
         }
         if (minDis <= (radius + other.radius) * (radius + other.radius))
         {
             SDebug.LogWarning(gameObject.name + " BAAAAAANG!!!  " + minDis);
         }
     }
     selfres  = new SCollisionResult();
     otherres = new SCollisionResult();
     return(false);
 }
Beispiel #3
0
 protected void handleResult(SCollisionResult res)
 {
 }
Beispiel #4
0
 protected override bool GenerateCollisionRes(SICollider other, out SCollisionResult selfres, out SCollisionResult otherres)
 {
     selfres  = new SCollisionResult();
     otherres = new SCollisionResult();
     return(false);
 }
Beispiel #5
0
 protected abstract bool GenerateCollisionRes(SICollider other, out SCollisionResult selfres, out SCollisionResult otherres);
Beispiel #6
0
 public virtual void OnCollisionEnd(SCollisionResult res)
 {
 }
Beispiel #7
0
 public virtual void OnCollisionStay(SCollisionResult res)
 {
 }