protected override void RunLogical(long elapsedTime) { GenerateSuperCell(); lock (locker) { double ets = elapsedTime / 1000.0f; player.Move(ets); foreach (var sk in aiSnakes) { sk.Move(ets); } } var boundCollision = CheckBoundCollision(); var selfCollision = CheckSelfCollision(); var pairCollision = CheckPlayerCollision(); var scCollision = CheckSuperCellCollision(); lock (locker) { // Applay bound collision foreach (var col in boundCollision) { if (!col.Item1.Status.HasFlag(SnakeStatus.Stunned) && !col.Item1.Status.HasFlag(SnakeStatus.AfterStunned)) { col.Item1.Status |= SnakeStatus.Stunned; } col.Item1.Rebound(col.Item2.Position, col.Item2.Normal); } // Apply self collision foreach (var col in selfCollision) { col.Key.Status |= SnakeStatus.Stunned; } // Apply pair collision Fracture(pairCollision); // Apply eat super cell scCollision.Shuffle(); foreach (var col in scCollision) { if (!col.Status.HasFlag(SnakeStatus.Stunned)) { col.Status |= SnakeStatus.Super; col.Lengthen(20); break; } } } }